diff options
author | dslomov@chromium.org <dslomov@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-12-29 22:45:17 +0000 |
---|---|---|
committer | dslomov@chromium.org <dslomov@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-12-29 22:45:17 +0000 |
commit | cd08475254a257c64ddce0e5b029d0f795b01b03 (patch) | |
tree | 0ef748b97d1a3f9450581d3ce244a68edffb78d6 /content/worker | |
parent | cc289a6c2cc29b1d6d6eb66f49a303846ecbb7d4 (diff) | |
download | chromium_src-cd08475254a257c64ddce0e5b029d0f795b01b03.zip chromium_src-cd08475254a257c64ddce0e5b029d0f795b01b03.tar.gz chromium_src-cd08475254a257c64ddce0e5b029d0f795b01b03.tar.bz2 |
Remove the uses of WebWorkerClient, replace with WebSharedWorkerClient.
Review URL: http://codereview.chromium.org/9003007
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@115993 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'content/worker')
-rw-r--r-- | content/worker/websharedworker_stub.h | 11 | ||||
-rw-r--r-- | content/worker/websharedworkerclient_proxy.cc (renamed from content/worker/webworkerclient_proxy.cc) | 56 | ||||
-rw-r--r-- | content/worker/websharedworkerclient_proxy.h (renamed from content/worker/webworkerclient_proxy.h) | 17 |
3 files changed, 44 insertions, 40 deletions
diff --git a/content/worker/websharedworker_stub.h b/content/worker/websharedworker_stub.h index 77e063a..4ffe2a0 100644 --- a/content/worker/websharedworker_stub.h +++ b/content/worker/websharedworker_stub.h @@ -7,7 +7,7 @@ #pragma once #include "base/memory/scoped_ptr.h" -#include "content/worker/webworkerclient_proxy.h" +#include "content/worker/websharedworkerclient_proxy.h" #include "content/worker/worker_webapplicationcachehost_impl.h" #include "googleurl/src/gurl.h" #include "ipc/ipc_channel.h" @@ -29,14 +29,14 @@ class WebSharedWorkerStub : public IPC::Channel::Listener { virtual bool OnMessageReceived(const IPC::Message& message) OVERRIDE; virtual void OnChannelError() OVERRIDE; - // Invoked when the WebWorkerClientProxy is shutting down. + // Invoked when the WebSharedWorkerClientProxy is shutting down. void Shutdown(); // Called after terminating the worker context to make sure that the worker // actually terminates (is not stuck in an infinite loop). void EnsureWorkerContextTerminates(); - WebWorkerClientProxy* client() { return &client_; } + WebSharedWorkerClientProxy* client() { return &client_; } const WorkerAppCacheInitInfo& appcache_init_info() const { return appcache_init_info_; @@ -57,8 +57,9 @@ class WebSharedWorkerStub : public IPC::Channel::Listener { int route_id_; WorkerAppCacheInitInfo appcache_init_info_; - // WebWorkerClient that responds to outgoing API calls from the worker object. - WebWorkerClientProxy client_; + // WebSharedWorkerClient that responds to outgoing API calls + // from the worker object. + WebSharedWorkerClientProxy client_; WebKit::WebSharedWorker* impl_; string16 name_; diff --git a/content/worker/webworkerclient_proxy.cc b/content/worker/websharedworkerclient_proxy.cc index 9365340..78ffdd1 100644 --- a/content/worker/webworkerclient_proxy.cc +++ b/content/worker/websharedworkerclient_proxy.cc @@ -2,7 +2,7 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#include "content/worker/webworkerclient_proxy.h" +#include "content/worker/websharedworkerclient_proxy.h" #include "base/bind.h" #include "base/command_line.h" @@ -12,9 +12,9 @@ #include "content/common/webmessageportchannel_impl.h" #include "content/common/worker_messages.h" #include "content/public/common/content_switches.h" -// TODO(jam): uncomment this and WebWorkerClientProxy::createWorker when the -// renderer worker code moves to content. This code isn't used now since we -// don't support nested workers anyways. +// TODO(jam): uncomment this and WebSharedWorkerClientProxy::createWorker +// when the renderer worker code moves to content. This code isn't used +// now since we don't support nested workers anyways. //#include "content/renderer/webworker_proxy.h" #include "content/worker/shared_worker_devtools_agent.h" #include "content/worker/websharedworker_stub.h" @@ -36,13 +36,13 @@ using WebKit::WebMessagePortChannelArray; using WebKit::WebSecurityOrigin; using WebKit::WebString; using WebKit::WebWorker; -using WebKit::WebWorkerClient; +using WebKit::WebSharedWorkerClient; // How long to wait for worker to finish after it's been told to terminate. #define kMaxTimeForRunawayWorkerMs 3000 -WebWorkerClientProxy::WebWorkerClientProxy(int route_id, - WebSharedWorkerStub* stub) +WebSharedWorkerClientProxy::WebSharedWorkerClientProxy( + int route_id, WebSharedWorkerStub* stub) : route_id_(route_id), appcache_host_id_(0), stub_(stub), @@ -50,10 +50,10 @@ WebWorkerClientProxy::WebWorkerClientProxy(int route_id, devtools_agent_(NULL) { } -WebWorkerClientProxy::~WebWorkerClientProxy() { +WebSharedWorkerClientProxy::~WebSharedWorkerClientProxy() { } -void WebWorkerClientProxy::postMessageToWorkerObject( +void WebSharedWorkerClientProxy::postMessageToWorkerObject( const WebString& message, const WebMessagePortChannelArray& channels) { std::vector<int> message_port_ids(channels.size()); @@ -71,7 +71,7 @@ void WebWorkerClientProxy::postMessageToWorkerObject( route_id_, message, message_port_ids, routing_ids)); } -void WebWorkerClientProxy::postExceptionToWorkerObject( +void WebSharedWorkerClientProxy::postExceptionToWorkerObject( const WebString& error_message, int line_number, const WebString& source_url) { @@ -79,7 +79,7 @@ void WebWorkerClientProxy::postExceptionToWorkerObject( route_id_, error_message, line_number, source_url)); } -void WebWorkerClientProxy::postConsoleMessageToWorkerObject( +void WebSharedWorkerClientProxy::postConsoleMessageToWorkerObject( int source, int type, int level, @@ -96,30 +96,31 @@ void WebWorkerClientProxy::postConsoleMessageToWorkerObject( Send(new WorkerHostMsg_PostConsoleMessageToWorkerObject(route_id_, params)); } -void WebWorkerClientProxy::confirmMessageFromWorkerObject( +void WebSharedWorkerClientProxy::confirmMessageFromWorkerObject( bool has_pending_activity) { Send(new WorkerHostMsg_ConfirmMessageFromWorkerObject( route_id_, has_pending_activity)); } -void WebWorkerClientProxy::reportPendingActivity(bool has_pending_activity) { +void WebSharedWorkerClientProxy::reportPendingActivity( + bool has_pending_activity) { Send(new WorkerHostMsg_ReportPendingActivity( route_id_, has_pending_activity)); } -void WebWorkerClientProxy::workerContextClosed() { +void WebSharedWorkerClientProxy::workerContextClosed() { Send(new WorkerHostMsg_WorkerContextClosed(route_id_)); } -void WebWorkerClientProxy::workerContextDestroyed() { +void WebSharedWorkerClientProxy::workerContextDestroyed() { Send(new WorkerHostMsg_WorkerContextDestroyed(route_id_)); // Tell the stub that the worker has shutdown - frees this object. if (stub_) stub_->Shutdown(); } -WebKit::WebWorker* WebWorkerClientProxy::createWorker( - WebKit::WebWorkerClient* client) { +WebKit::WebWorker* WebSharedWorkerClientProxy::createWorker( + WebKit::WebSharedWorkerClient* client) { // TODO(jam): see comment at top of file //return new WebWorkerProxy(client, WorkerThread::current(), // 0, appcache_host_id_); @@ -127,14 +128,14 @@ WebKit::WebWorker* WebWorkerClientProxy::createWorker( } WebKit::WebNotificationPresenter* -WebWorkerClientProxy::notificationPresenter() { +WebSharedWorkerClientProxy::notificationPresenter() { // TODO(johnnyg): Notifications are not yet hooked up to workers. // Coming soon. NOTREACHED(); return NULL; } -WebApplicationCacheHost* WebWorkerClientProxy::createApplicationCacheHost( +WebApplicationCacheHost* WebSharedWorkerClientProxy::createApplicationCacheHost( WebKit::WebApplicationCacheHostClient* client) { WorkerWebApplicationCacheHostImpl* host = new WorkerWebApplicationCacheHostImpl(stub_->appcache_init_info(), @@ -148,7 +149,7 @@ WebApplicationCacheHost* WebWorkerClientProxy::createApplicationCacheHost( // TODO(abarth): Security checks should use WebDocument or WebSecurityOrigin, // not WebFrame as the context object because WebFrames can contain different // WebDocuments at different times. -bool WebWorkerClientProxy::allowDatabase(WebFrame* frame, +bool WebSharedWorkerClientProxy::allowDatabase(WebFrame* frame, const WebString& name, const WebString& display_name, unsigned long estimated_size) { @@ -163,14 +164,14 @@ bool WebWorkerClientProxy::allowDatabase(WebFrame* frame, return result; } -bool WebWorkerClientProxy::allowFileSystem() { +bool WebSharedWorkerClientProxy::allowFileSystem() { bool result = false; Send(new WorkerProcessHostMsg_AllowFileSystem( route_id_, stub_->url().GetOrigin(), &result)); return result; } -void WebWorkerClientProxy::openFileSystem( +void WebSharedWorkerClientProxy::openFileSystem( WebKit::WebFileSystem::Type type, long long size, bool create, @@ -180,22 +181,23 @@ void WebWorkerClientProxy::openFileSystem( size, create, new WebFileSystemCallbackDispatcher(callbacks)); } -void WebWorkerClientProxy::dispatchDevToolsMessage(const WebString& message) { +void WebSharedWorkerClientProxy::dispatchDevToolsMessage( + const WebString& message) { if (devtools_agent_) devtools_agent_->SendDevToolsMessage(message); } -void WebWorkerClientProxy::saveDevToolsAgentState( +void WebSharedWorkerClientProxy::saveDevToolsAgentState( const WebKit::WebString& state) { if (devtools_agent_) devtools_agent_->SaveDevToolsAgentState(state); } -bool WebWorkerClientProxy::Send(IPC::Message* message) { +bool WebSharedWorkerClientProxy::Send(IPC::Message* message) { return WorkerThread::current()->Send(message); } -void WebWorkerClientProxy::EnsureWorkerContextTerminates() { +void WebSharedWorkerClientProxy::EnsureWorkerContextTerminates() { // Avoid a worker doing a while(1) from never exiting. if (CommandLine::ForCurrentProcess()->HasSwitch( switches::kWebWorkerShareProcesses)) { @@ -211,7 +213,7 @@ void WebWorkerClientProxy::EnsureWorkerContextTerminates() { // will exit the message loop and subsequent ones won't be executed. MessageLoop::current()->PostDelayedTask(FROM_HERE, base::Bind( - &WebWorkerClientProxy::workerContextDestroyed, + &WebSharedWorkerClientProxy::workerContextDestroyed, weak_factory_.GetWeakPtr()), kMaxTimeForRunawayWorkerMs); } diff --git a/content/worker/webworkerclient_proxy.h b/content/worker/websharedworkerclient_proxy.h index f614a76..9d6891cd 100644 --- a/content/worker/webworkerclient_proxy.h +++ b/content/worker/websharedworkerclient_proxy.h @@ -10,7 +10,7 @@ #include "base/memory/weak_ptr.h" #include "ipc/ipc_channel.h" #include "third_party/WebKit/Source/WebKit/chromium/public/platform/WebFileSystem.h" -#include "third_party/WebKit/Source/WebKit/chromium/public/WebWorkerClient.h" +#include "third_party/WebKit/Source/WebKit/chromium/public/WebSharedWorkerClient.h" namespace WebKit { class WebApplicationCacheHost; @@ -27,12 +27,12 @@ class WebSharedWorkerStub; // is also called by the worker code and converts these function calls into // IPCs that are sent to the renderer, where they're converted back to function // calls by WebWorkerProxy. -class WebWorkerClientProxy : public WebKit::WebWorkerClient { +class WebSharedWorkerClientProxy : public WebKit::WebSharedWorkerClient { public: - WebWorkerClientProxy(int route_id, WebSharedWorkerStub* stub); - virtual ~WebWorkerClientProxy(); + WebSharedWorkerClientProxy(int route_id, WebSharedWorkerStub* stub); + virtual ~WebSharedWorkerClientProxy(); - // WebWorkerClient implementation. + // WebSharedWorkerClient implementation. virtual void postMessageToWorkerObject( const WebKit::WebString& message, const WebKit::WebMessagePortChannelArray& channel); @@ -63,7 +63,8 @@ class WebWorkerClientProxy : public WebKit::WebWorkerClient { virtual void reportPendingActivity(bool has_pending_activity); virtual void workerContextClosed(); virtual void workerContextDestroyed(); - virtual WebKit::WebWorker* createWorker(WebKit::WebWorkerClient* client); + virtual WebKit::WebWorker* createWorker( + WebKit::WebSharedWorkerClient* client); virtual WebKit::WebNotificationPresenter* notificationPresenter(); @@ -94,10 +95,10 @@ class WebWorkerClientProxy : public WebKit::WebWorkerClient { int route_id_; int appcache_host_id_; WebSharedWorkerStub* stub_; - base::WeakPtrFactory<WebWorkerClientProxy> weak_factory_; + base::WeakPtrFactory<WebSharedWorkerClientProxy> weak_factory_; SharedWorkerDevToolsAgent* devtools_agent_; - DISALLOW_COPY_AND_ASSIGN(WebWorkerClientProxy); + DISALLOW_COPY_AND_ASSIGN(WebSharedWorkerClientProxy); }; #endif // CONTENT_WORKER_WEBWORKERCLIENT_PROXY_H_ |