Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(410)

Side by Side Diff: third_party/WebKit/Source/modules/broadcastchannel/BroadcastChannel.cpp

Issue 2909613002: Replaced usage of RefPtr::Release with std::move wraps. (Closed)
Patch Set: Created 3 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 // Copyright 2016 The Chromium Authors. All rights reserved. 1 // Copyright 2016 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "modules/broadcastchannel/BroadcastChannel.h" 5 #include "modules/broadcastchannel/BroadcastChannel.h"
6 6
7 #include "bindings/core/v8/serialization/SerializedScriptValue.h" 7 #include "bindings/core/v8/serialization/SerializedScriptValue.h"
8 #include "core/dom/ExceptionCode.h" 8 #include "core/dom/ExceptionCode.h"
9 #include "core/events/EventQueue.h" 9 #include "core/events/EventQueue.h"
10 #include "core/events/MessageEvent.h" 10 #include "core/events/MessageEvent.h"
(...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after
98 EventTargetWithInlineData::Trace(visitor); 98 EventTargetWithInlineData::Trace(visitor);
99 } 99 }
100 100
101 void BroadcastChannel::OnMessage(const WTF::Vector<uint8_t>& message) { 101 void BroadcastChannel::OnMessage(const WTF::Vector<uint8_t>& message) {
102 // Queue a task to dispatch the event. 102 // Queue a task to dispatch the event.
103 RefPtr<SerializedScriptValue> value = SerializedScriptValue::Create( 103 RefPtr<SerializedScriptValue> value = SerializedScriptValue::Create(
104 message.IsEmpty() ? nullptr 104 message.IsEmpty() ? nullptr
105 : reinterpret_cast<const char*>(&message.front()), 105 : reinterpret_cast<const char*>(&message.front()),
106 message.size()); 106 message.size());
107 MessageEvent* event = MessageEvent::Create( 107 MessageEvent* event = MessageEvent::Create(
108 nullptr, value.Release(), 108 nullptr, std::move(value),
109 GetExecutionContext()->GetSecurityOrigin()->ToString()); 109 GetExecutionContext()->GetSecurityOrigin()->ToString());
110 event->SetTarget(this); 110 event->SetTarget(this);
111 bool success = GetExecutionContext()->GetEventQueue()->EnqueueEvent(event); 111 bool success = GetExecutionContext()->GetEventQueue()->EnqueueEvent(event);
112 DCHECK(success); 112 DCHECK(success);
113 ALLOW_UNUSED_LOCAL(success); 113 ALLOW_UNUSED_LOCAL(success);
114 } 114 }
115 115
116 void BroadcastChannel::OnError() { 116 void BroadcastChannel::OnError() {
117 close(); 117 close();
118 } 118 }
(...skipping 18 matching lines...) Expand all
137 // browser. 137 // browser.
138 auto remote_cient_request = mojo::MakeRequest(&remote_client_); 138 auto remote_cient_request = mojo::MakeRequest(&remote_client_);
139 remote_client_.set_connection_error_handler(ConvertToBaseCallback( 139 remote_client_.set_connection_error_handler(ConvertToBaseCallback(
140 WTF::Bind(&BroadcastChannel::OnError, WrapWeakPersistent(this)))); 140 WTF::Bind(&BroadcastChannel::OnError, WrapWeakPersistent(this))));
141 141
142 provider->ConnectToChannel(origin_, name_, std::move(local_client_info), 142 provider->ConnectToChannel(origin_, name_, std::move(local_client_info),
143 std::move(remote_cient_request)); 143 std::move(remote_cient_request));
144 } 144 }
145 145
146 } // namespace blink 146 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698