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

Side by Side Diff: content/renderer/shared_worker/embedded_shared_worker_stub.cc

Issue 944443003: Step two of optionally sending messages to/from message ports as base::Value. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@n-c-message-as-values-take2
Patch Set: use auto where it makes sense Created 5 years, 9 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
« no previous file with comments | « content/renderer/service_worker/service_worker_script_context.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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 "content/renderer/shared_worker/embedded_shared_worker_stub.h" 5 #include "content/renderer/shared_worker/embedded_shared_worker_stub.h"
6 6
7 #include "base/message_loop/message_loop_proxy.h" 7 #include "base/message_loop/message_loop_proxy.h"
8 #include "content/child/appcache/appcache_dispatcher.h" 8 #include "content/child/appcache/appcache_dispatcher.h"
9 #include "content/child/appcache/web_application_cache_host_impl.h" 9 #include "content/child/appcache/web_application_cache_host_impl.h"
10 #include "content/child/request_extra_data.h" 10 #include "content/child/request_extra_data.h"
(...skipping 256 matching lines...) Expand 10 before | Expand all | Expand 10 after
267 267
268 void EmbeddedSharedWorkerStub::ConnectToChannel( 268 void EmbeddedSharedWorkerStub::ConnectToChannel(
269 WebMessagePortChannelImpl* channel) { 269 WebMessagePortChannelImpl* channel) {
270 impl_->connect(channel); 270 impl_->connect(channel);
271 Send( 271 Send(
272 new WorkerHostMsg_WorkerConnected(channel->message_port_id(), route_id_)); 272 new WorkerHostMsg_WorkerConnected(channel->message_port_id(), route_id_));
273 } 273 }
274 274
275 void EmbeddedSharedWorkerStub::OnConnect(int sent_message_port_id, 275 void EmbeddedSharedWorkerStub::OnConnect(int sent_message_port_id,
276 int routing_id) { 276 int routing_id) {
277 TransferredMessagePort port;
278 port.id = sent_message_port_id;
277 WebMessagePortChannelImpl* channel = 279 WebMessagePortChannelImpl* channel =
278 new WebMessagePortChannelImpl(routing_id, 280 new WebMessagePortChannelImpl(routing_id,
279 sent_message_port_id, 281 port,
280 base::MessageLoopProxy::current().get()); 282 base::MessageLoopProxy::current().get());
281 if (runing_) { 283 if (runing_) {
282 ConnectToChannel(channel); 284 ConnectToChannel(channel);
283 } else { 285 } else {
284 // If two documents try to load a SharedWorker at the same time, the 286 // If two documents try to load a SharedWorker at the same time, the
285 // WorkerMsg_Connect for one of the documents can come in before the 287 // WorkerMsg_Connect for one of the documents can come in before the
286 // worker is started. Just queue up the connect and deliver it once the 288 // worker is started. Just queue up the connect and deliver it once the
287 // worker starts. 289 // worker starts.
288 pending_channels_.push_back(channel); 290 pending_channels_.push_back(channel);
289 } 291 }
290 } 292 }
291 293
292 void EmbeddedSharedWorkerStub::OnTerminateWorkerContext() { 294 void EmbeddedSharedWorkerStub::OnTerminateWorkerContext() {
293 runing_ = false; 295 runing_ = false;
294 impl_->terminateWorkerContext(); 296 impl_->terminateWorkerContext();
295 } 297 }
296 298
297 } // namespace content 299 } // namespace content
OLDNEW
« no previous file with comments | « content/renderer/service_worker/service_worker_script_context.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698