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

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

Issue 7248076: DevTools: add initial support for shared workers debugging (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Rebase Created 9 years, 5 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 | Annotate | Revision Log
« no previous file with comments | « content/worker/websharedworker_stub.h ('k') | content/worker/webworker_stub.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) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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 "content/common/child_thread.h" 7 #include "content/common/child_thread.h"
8 #include "content/common/file_system/file_system_dispatcher.h" 8 #include "content/common/file_system/file_system_dispatcher.h"
9 #include "content/common/webmessageportchannel_impl.h" 9 #include "content/common/webmessageportchannel_impl.h"
10 #include "content/common/worker_messages.h" 10 #include "content/common/worker_messages.h"
11 #include "content/worker/worker_devtools_agent.h"
11 #include "third_party/WebKit/Source/WebKit/chromium/public/WebSharedWorker.h" 12 #include "third_party/WebKit/Source/WebKit/chromium/public/WebSharedWorker.h"
12 #include "third_party/WebKit/Source/WebKit/chromium/public/WebString.h" 13 #include "third_party/WebKit/Source/WebKit/chromium/public/WebString.h"
13 #include "third_party/WebKit/Source/WebKit/chromium/public/WebURL.h" 14 #include "third_party/WebKit/Source/WebKit/chromium/public/WebURL.h"
14 15
15 WebSharedWorkerStub::WebSharedWorkerStub( 16 WebSharedWorkerStub::WebSharedWorkerStub(
16 const string16& name, int route_id, 17 const string16& name, int route_id,
17 const WorkerAppCacheInitInfo& appcache_init_info) 18 const WorkerAppCacheInitInfo& appcache_init_info)
18 : WebWorkerStubBase(route_id, appcache_init_info), 19 : WebWorkerStubBase(route_id, appcache_init_info),
19 name_(name), 20 name_(name),
20 started_(false) { 21 started_(false),
22 worker_devtools_agent_(NULL) {
21 // TODO(atwilson): Add support for NaCl when they support MessagePorts. 23 // TODO(atwilson): Add support for NaCl when they support MessagePorts.
22 impl_ = WebKit::WebSharedWorker::create(client()); 24 impl_ = WebKit::WebSharedWorker::create(client());
25 worker_devtools_agent_.reset(WorkerDevToolsAgent::CreateForSharedWorker(
26 route_id, impl_));
27 client()->set_devtools_agent(worker_devtools_agent_.get());
23 } 28 }
24 29
25 WebSharedWorkerStub::~WebSharedWorkerStub() { 30 WebSharedWorkerStub::~WebSharedWorkerStub() {
26 impl_->clientDestroyed(); 31 impl_->clientDestroyed();
27 } 32 }
28 33
29 bool WebSharedWorkerStub::OnMessageReceived(const IPC::Message& message) { 34 bool WebSharedWorkerStub::OnMessageReceived(const IPC::Message& message) {
35 if (worker_devtools_agent_->OnMessageReceived(message))
36 return true;
37
30 bool handled = true; 38 bool handled = true;
31 IPC_BEGIN_MESSAGE_MAP(WebSharedWorkerStub, message) 39 IPC_BEGIN_MESSAGE_MAP(WebSharedWorkerStub, message)
32 IPC_MESSAGE_HANDLER(WorkerMsg_StartWorkerContext, OnStartWorkerContext) 40 IPC_MESSAGE_HANDLER(WorkerMsg_StartWorkerContext, OnStartWorkerContext)
33 IPC_MESSAGE_HANDLER(WorkerMsg_TerminateWorkerContext, 41 IPC_MESSAGE_HANDLER(WorkerMsg_TerminateWorkerContext,
34 OnTerminateWorkerContext) 42 OnTerminateWorkerContext)
35 IPC_MESSAGE_HANDLER(WorkerMsg_Connect, OnConnect) 43 IPC_MESSAGE_HANDLER(WorkerMsg_Connect, OnConnect)
36 IPC_MESSAGE_UNHANDLED(handled = false) 44 IPC_MESSAGE_UNHANDLED(handled = false)
37 IPC_END_MESSAGE_MAP() 45 IPC_END_MESSAGE_MAP()
38 return handled; 46 return handled;
39 } 47 }
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after
81 } 89 }
82 } 90 }
83 91
84 void WebSharedWorkerStub::OnTerminateWorkerContext() { 92 void WebSharedWorkerStub::OnTerminateWorkerContext() {
85 impl_->terminateWorkerContext(); 93 impl_->terminateWorkerContext();
86 94
87 // Call the client to make sure context exits. 95 // Call the client to make sure context exits.
88 EnsureWorkerContextTerminates(); 96 EnsureWorkerContextTerminates();
89 started_ = false; 97 started_ = false;
90 } 98 }
OLDNEW
« no previous file with comments | « content/worker/websharedworker_stub.h ('k') | content/worker/webworker_stub.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698