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

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

Issue 8556001: Convert NewRunnableFunction/NewRunnableMethod calls to use base::Bind(). (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: . Created 9 years, 1 month 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/webworkerclient_proxy.h ('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 (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/webworkerclient_proxy.h" 5 #include "content/worker/webworkerclient_proxy.h"
6 6
7 #include "base/bind.h"
7 #include "base/command_line.h" 8 #include "base/command_line.h"
8 #include "base/message_loop.h" 9 #include "base/message_loop.h"
9 #include "content/common/file_system/file_system_dispatcher.h" 10 #include "content/common/file_system/file_system_dispatcher.h"
10 #include "content/common/file_system/webfilesystem_callback_dispatcher.h" 11 #include "content/common/file_system/webfilesystem_callback_dispatcher.h"
11 #include "content/common/webmessageportchannel_impl.h" 12 #include "content/common/webmessageportchannel_impl.h"
12 #include "content/common/worker_messages.h" 13 #include "content/common/worker_messages.h"
13 #include "content/public/common/content_switches.h" 14 #include "content/public/common/content_switches.h"
14 // TODO(jam): uncomment this and WebWorkerClientProxy::createWorker when the 15 // TODO(jam): uncomment this and WebWorkerClientProxy::createWorker when the
15 // renderer worker code moves to content. This code isn't used now since we 16 // renderer worker code moves to content. This code isn't used now since we
16 // don't support nested workers anyways. 17 // don't support nested workers anyways.
(...skipping 21 matching lines...) Expand all
38 using WebKit::WebWorkerClient; 39 using WebKit::WebWorkerClient;
39 40
40 // How long to wait for worker to finish after it's been told to terminate. 41 // How long to wait for worker to finish after it's been told to terminate.
41 #define kMaxTimeForRunawayWorkerMs 3000 42 #define kMaxTimeForRunawayWorkerMs 3000
42 43
43 WebWorkerClientProxy::WebWorkerClientProxy(int route_id, 44 WebWorkerClientProxy::WebWorkerClientProxy(int route_id,
44 WebSharedWorkerStub* stub) 45 WebSharedWorkerStub* stub)
45 : route_id_(route_id), 46 : route_id_(route_id),
46 appcache_host_id_(0), 47 appcache_host_id_(0),
47 stub_(stub), 48 stub_(stub),
48 ALLOW_THIS_IN_INITIALIZER_LIST(kill_process_factory_(this)), 49 ALLOW_THIS_IN_INITIALIZER_LIST(weak_factory_(this)),
49 devtools_agent_(NULL) { 50 devtools_agent_(NULL) {
50 } 51 }
51 52
52 WebWorkerClientProxy::~WebWorkerClientProxy() { 53 WebWorkerClientProxy::~WebWorkerClientProxy() {
53 } 54 }
54 55
55 void WebWorkerClientProxy::postMessageToWorkerObject( 56 void WebWorkerClientProxy::postMessageToWorkerObject(
56 const WebString& message, 57 const WebString& message,
57 const WebMessagePortChannelArray& channels) { 58 const WebMessagePortChannelArray& channels) {
58 std::vector<int> message_port_ids(channels.size()); 59 std::vector<int> message_port_ids(channels.size());
(...skipping 143 matching lines...) Expand 10 before | Expand all | Expand 10 after
202 // renderer process. 203 // renderer process.
203 NOTIMPLEMENTED(); 204 NOTIMPLEMENTED();
204 return; 205 return;
205 } 206 }
206 207
207 // This shuts down the process cleanly from the perspective of the browser 208 // This shuts down the process cleanly from the perspective of the browser
208 // process, and avoids the crashed worker infobar from appearing to the new 209 // process, and avoids the crashed worker infobar from appearing to the new
209 // page. It's ok to post several of theese, because the first executed task 210 // page. It's ok to post several of theese, because the first executed task
210 // will exit the message loop and subsequent ones won't be executed. 211 // will exit the message loop and subsequent ones won't be executed.
211 MessageLoop::current()->PostDelayedTask(FROM_HERE, 212 MessageLoop::current()->PostDelayedTask(FROM_HERE,
212 kill_process_factory_.NewRunnableMethod( 213 base::Bind(
213 &WebWorkerClientProxy::workerContextDestroyed), 214 &WebWorkerClientProxy::workerContextDestroyed,
214 kMaxTimeForRunawayWorkerMs); 215 weak_factory_.GetWeakPtr()),
216 kMaxTimeForRunawayWorkerMs);
215 } 217 }
OLDNEW
« no previous file with comments | « content/worker/webworkerclient_proxy.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698