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

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

Issue 7477027: Support Transferable objects (Closed) Base URL: http://git.chromium.org/git/chromium.git@trunk
Patch Set: Rebase. Created 9 years, 4 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/webworkerclient_proxy.h ('k') | webkit/tools/test_shell/test_web_worker.h » ('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/webworkerclient_proxy.h" 5 #include "content/worker/webworkerclient_proxy.h"
6 6
7 #include "base/command_line.h" 7 #include "base/command_line.h"
8 #include "base/message_loop.h" 8 #include "base/message_loop.h"
9 #include "content/common/content_switches.h" 9 #include "content/common/content_switches.h"
10 #include "content/common/file_system/file_system_dispatcher.h" 10 #include "content/common/file_system/file_system_dispatcher.h"
(...skipping 13 matching lines...) Expand all
24 #include "third_party/WebKit/Source/WebKit/chromium/public/WebFileSystemCallback s.h" 24 #include "third_party/WebKit/Source/WebKit/chromium/public/WebFileSystemCallback s.h"
25 #include "third_party/WebKit/Source/WebKit/chromium/public/WebFrame.h" 25 #include "third_party/WebKit/Source/WebKit/chromium/public/WebFrame.h"
26 #include "third_party/WebKit/Source/WebKit/chromium/public/WebSecurityOrigin.h" 26 #include "third_party/WebKit/Source/WebKit/chromium/public/WebSecurityOrigin.h"
27 #include "third_party/WebKit/Source/WebKit/chromium/public/WebString.h" 27 #include "third_party/WebKit/Source/WebKit/chromium/public/WebString.h"
28 #include "third_party/WebKit/Source/WebKit/chromium/public/WebURL.h" 28 #include "third_party/WebKit/Source/WebKit/chromium/public/WebURL.h"
29 #include "third_party/WebKit/Source/WebKit/chromium/public/WebWorker.h" 29 #include "third_party/WebKit/Source/WebKit/chromium/public/WebWorker.h"
30 30
31 using WebKit::WebApplicationCacheHost; 31 using WebKit::WebApplicationCacheHost;
32 using WebKit::WebFrame; 32 using WebKit::WebFrame;
33 using WebKit::WebMessagePortChannel; 33 using WebKit::WebMessagePortChannel;
34 using WebKit::WebMessagePortChannelArray; 34 using WebKit::WebTransferableReceiptArray;
35 using WebKit::WebSecurityOrigin; 35 using WebKit::WebSecurityOrigin;
36 using WebKit::WebString; 36 using WebKit::WebString;
37 using WebKit::WebWorker; 37 using WebKit::WebWorker;
38 using WebKit::WebWorkerClient; 38 using WebKit::WebWorkerClient;
39 39
40 // How long to wait for worker to finish after it's been told to terminate. 40 // How long to wait for worker to finish after it's been told to terminate.
41 #define kMaxTimeForRunawayWorkerMs 3000 41 #define kMaxTimeForRunawayWorkerMs 3000
42 42
43 WebWorkerClientProxy::WebWorkerClientProxy(int route_id, 43 WebWorkerClientProxy::WebWorkerClientProxy(int route_id,
44 WebWorkerStubBase* stub) 44 WebWorkerStubBase* stub)
45 : route_id_(route_id), 45 : route_id_(route_id),
46 appcache_host_id_(0), 46 appcache_host_id_(0),
47 stub_(stub), 47 stub_(stub),
48 ALLOW_THIS_IN_INITIALIZER_LIST(kill_process_factory_(this)), 48 ALLOW_THIS_IN_INITIALIZER_LIST(kill_process_factory_(this)),
49 devtools_agent_(NULL) { 49 devtools_agent_(NULL) {
50 } 50 }
51 51
52 WebWorkerClientProxy::~WebWorkerClientProxy() { 52 WebWorkerClientProxy::~WebWorkerClientProxy() {
53 } 53 }
54 54
55 void WebWorkerClientProxy::postMessageToWorkerObject( 55 void WebWorkerClientProxy::postMessageToWorkerObject(
56 const WebString& message, 56 const WebString& message,
57 const WebMessagePortChannelArray& channels) { 57 const WebTransferableReceiptArray& channels) {
58 std::vector<int> message_port_ids(channels.size()); 58 std::vector<int> message_port_ids(channels.size());
59 std::vector<int> routing_ids(channels.size()); 59 std::vector<int> routing_ids(channels.size());
60 for (size_t i = 0; i < channels.size(); ++i) { 60 for (size_t i = 0; i < channels.size(); ++i) {
61 WebMessagePortChannelImpl* webchannel = 61 WebMessagePortChannelImpl* webchannel =
62 static_cast<WebMessagePortChannelImpl*>(channels[i]); 62 static_cast<WebMessagePortChannelImpl*>(channels[i]);
63 message_port_ids[i] = webchannel->message_port_id(); 63 message_port_ids[i] = webchannel->message_port_id();
64 webchannel->QueueMessages(); 64 webchannel->QueueMessages();
65 DCHECK(message_port_ids[i] != MSG_ROUTING_NONE); 65 DCHECK(message_port_ids[i] != MSG_ROUTING_NONE);
66 routing_ids[i] = MSG_ROUTING_NONE; 66 routing_ids[i] = MSG_ROUTING_NONE;
67 } 67 }
(...skipping 132 matching lines...) Expand 10 before | Expand all | Expand 10 after
200 200
201 // This shuts down the process cleanly from the perspective of the browser 201 // This shuts down the process cleanly from the perspective of the browser
202 // process, and avoids the crashed worker infobar from appearing to the new 202 // process, and avoids the crashed worker infobar from appearing to the new
203 // page. It's ok to post several of theese, because the first executed task 203 // page. It's ok to post several of theese, because the first executed task
204 // will exit the message loop and subsequent ones won't be executed. 204 // will exit the message loop and subsequent ones won't be executed.
205 MessageLoop::current()->PostDelayedTask(FROM_HERE, 205 MessageLoop::current()->PostDelayedTask(FROM_HERE,
206 kill_process_factory_.NewRunnableMethod( 206 kill_process_factory_.NewRunnableMethod(
207 &WebWorkerClientProxy::workerContextDestroyed), 207 &WebWorkerClientProxy::workerContextDestroyed),
208 kMaxTimeForRunawayWorkerMs); 208 kMaxTimeForRunawayWorkerMs);
209 } 209 }
OLDNEW
« no previous file with comments | « content/worker/webworkerclient_proxy.h ('k') | webkit/tools/test_shell/test_web_worker.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698