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

Side by Side Diff: content/worker/websharedworker_stub.cc

Issue 213423008: Add pause_on_start flag to WorkerProcessMsg_CreateWorker_Params. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: incorporated yurys's comment Created 6 years, 8 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/worker/websharedworker_stub.h ('k') | content/worker/worker_thread.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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/worker/websharedworker_stub.h" 5 #include "content/worker/websharedworker_stub.h"
6 6
7 #include "base/compiler_specific.h" 7 #include "base/compiler_specific.h"
8 #include "content/child/child_process.h" 8 #include "content/child/child_process.h"
9 #include "content/child/child_thread.h" 9 #include "content/child/child_thread.h"
10 #include "content/child/fileapi/file_system_dispatcher.h" 10 #include "content/child/fileapi/file_system_dispatcher.h"
11 #include "content/child/shared_worker_devtools_agent.h" 11 #include "content/child/shared_worker_devtools_agent.h"
12 #include "content/child/webmessageportchannel_impl.h" 12 #include "content/child/webmessageportchannel_impl.h"
13 #include "content/common/worker_messages.h" 13 #include "content/common/worker_messages.h"
14 #include "content/worker/worker_thread.h" 14 #include "content/worker/worker_thread.h"
15 #include "third_party/WebKit/public/web/WebSharedWorker.h" 15 #include "third_party/WebKit/public/web/WebSharedWorker.h"
16 #include "third_party/WebKit/public/platform/WebString.h" 16 #include "third_party/WebKit/public/platform/WebString.h"
17 #include "third_party/WebKit/public/platform/WebURL.h" 17 #include "third_party/WebKit/public/platform/WebURL.h"
18 18
19 namespace content { 19 namespace content {
20 20
21 WebSharedWorkerStub::WebSharedWorkerStub( 21 WebSharedWorkerStub::WebSharedWorkerStub(
22 const GURL& url, 22 const GURL& url,
23 const base::string16& name, 23 const base::string16& name,
24 const base::string16& content_security_policy, 24 const base::string16& content_security_policy,
25 blink::WebContentSecurityPolicyType security_policy_type, 25 blink::WebContentSecurityPolicyType security_policy_type,
26 bool pause_on_start,
26 int route_id) 27 int route_id)
27 : route_id_(route_id), 28 : route_id_(route_id),
28 client_(route_id, this), 29 client_(route_id, this),
29 running_(false), 30 running_(false),
30 url_(url) { 31 url_(url) {
31 32
32 WorkerThread* worker_thread = WorkerThread::current(); 33 WorkerThread* worker_thread = WorkerThread::current();
33 DCHECK(worker_thread); 34 DCHECK(worker_thread);
34 worker_thread->AddWorkerStub(this); 35 worker_thread->AddWorkerStub(this);
35 // Start processing incoming IPCs for this worker. 36 // Start processing incoming IPCs for this worker.
36 worker_thread->GetRouter()->AddRoute(route_id_, this); 37 worker_thread->GetRouter()->AddRoute(route_id_, this);
37 38
38 // TODO(atwilson): Add support for NaCl when they support MessagePorts. 39 // TODO(atwilson): Add support for NaCl when they support MessagePorts.
39 impl_ = blink::WebSharedWorker::create(client()); 40 impl_ = blink::WebSharedWorker::create(client());
41 if (pause_on_start) {
42 // Pause worker context when it starts and wait until either DevTools client
43 // is attached or explicit resume notification is received.
44 impl_->pauseWorkerContextOnStart();
45 }
40 worker_devtools_agent_.reset(new SharedWorkerDevToolsAgent(route_id, impl_)); 46 worker_devtools_agent_.reset(new SharedWorkerDevToolsAgent(route_id, impl_));
41 client()->set_devtools_agent(worker_devtools_agent_.get()); 47 client()->set_devtools_agent(worker_devtools_agent_.get());
42 impl_->startWorkerContext(url_, name, 48 impl_->startWorkerContext(url_, name,
43 content_security_policy, security_policy_type); 49 content_security_policy, security_policy_type);
44 } 50 }
45 51
46 WebSharedWorkerStub::~WebSharedWorkerStub() { 52 WebSharedWorkerStub::~WebSharedWorkerStub() {
47 impl_->clientDestroyed(); 53 impl_->clientDestroyed();
48 WorkerThread* worker_thread = WorkerThread::current(); 54 WorkerThread* worker_thread = WorkerThread::current();
49 DCHECK(worker_thread); 55 DCHECK(worker_thread);
(...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after
128 iter != pending_channels_.end(); 134 iter != pending_channels_.end();
129 ++iter) { 135 ++iter) {
130 blink::WebMessagePortChannel* channel = *iter; 136 blink::WebMessagePortChannel* channel = *iter;
131 channel->destroy(); 137 channel->destroy();
132 } 138 }
133 pending_channels_.clear(); 139 pending_channels_.clear();
134 Shutdown(); 140 Shutdown();
135 } 141 }
136 142
137 } // namespace content 143 } // namespace content
OLDNEW
« no previous file with comments | « content/worker/websharedworker_stub.h ('k') | content/worker/worker_thread.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698