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

Side by Side Diff: chrome/worker/nativewebworker_impl.cc

Issue 173193: Updating Worker.postMessage(), DOMWindow.postMessage(), and... (Closed) Base URL: http://src.chromium.org/svn/trunk/src/
Patch Set: '' Created 11 years, 3 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 | « chrome/worker/nativewebworker_impl.h ('k') | chrome/worker/webworkerclient_proxy.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) 2009 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2009 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 "chrome/worker/nativewebworker_impl.h" 5 #include "chrome/worker/nativewebworker_impl.h"
6 6
7 #include "base/compiler_specific.h" 7 #include "base/compiler_specific.h"
8 8
9 #undef LOG 9 #undef LOG
10 10
(...skipping 17 matching lines...) Expand all
28 // PostMessageTask encapsulates sending messages from native web workers to 28 // PostMessageTask encapsulates sending messages from native web workers to
29 // the renderer by placing them on the main thread's message loop. 29 // the renderer by placing them on the main thread's message loop.
30 class PostMessageTask : public Task { 30 class PostMessageTask : public Task {
31 public: 31 public:
32 PostMessageTask(const char* bufp, WebKit::WebWorkerClient* client) 32 PostMessageTask(const char* bufp, WebKit::WebWorkerClient* client)
33 : message_string_(WebKit::WebString::fromUTF8(bufp)), 33 : message_string_(WebKit::WebString::fromUTF8(bufp)),
34 client_(client) { 34 client_(client) {
35 } 35 }
36 ~PostMessageTask() { } 36 ~PostMessageTask() { }
37 void Run() { 37 void Run() {
38 client_->postMessageToWorkerObject(message_string_, NULL); 38 WebKit::WebMessagePortChannelArray empty_array;
39 client_->postMessageToWorkerObject(message_string_, empty_array);
39 } 40 }
40 41
41 private: 42 private:
42 WebKit::WebString message_string_; 43 WebKit::WebString message_string_;
43 WebKit::WebWorkerClient* client_; 44 WebKit::WebWorkerClient* client_;
44 45
45 DISALLOW_COPY_AND_ASSIGN(PostMessageTask); 46 DISALLOW_COPY_AND_ASSIGN(PostMessageTask);
46 }; 47 };
47 48
48 // PostToRenderer places a string in bufp in a message and enqueues 49 // PostToRenderer places a string in bufp in a message and enqueues
(...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after
140 void NativeWebWorkerImpl::terminateWorkerContext() { 141 void NativeWebWorkerImpl::terminateWorkerContext() {
141 // Close the descriptors. 142 // Close the descriptors.
142 NaClDestroyUpcallChannel(descs_); 143 NaClDestroyUpcallChannel(descs_);
143 // Shut down the sel_ldr instance for this native web worker. 144 // Shut down the sel_ldr instance for this native web worker.
144 retval = NaClTerminateNativeWebWorker(&nap_, &channel_); 145 retval = NaClTerminateNativeWebWorker(&nap_, &channel_);
145 // Shut down the upcall thread. 146 // Shut down the upcall thread.
146 upcall_thread_->Stop(); 147 upcall_thread_->Stop();
147 } 148 }
148 149
149 void NativeWebWorkerImpl::postMessageToWorkerContext( 150 void NativeWebWorkerImpl::postMessageToWorkerContext(
150 const WebKit::WebString& message, WebKit::WebMessagePortChannel* channel) { 151 const WebKit::WebString& message,
152 const WebKit::WebMessagePortChannelArray& channel) {
151 size_t len; 153 size_t len;
152 char* bufp = WebStringToCharp(message, &len); 154 char* bufp = WebStringToCharp(message, &len);
153 // Send a message to NaCl object 155 // Send a message to NaCl object
154 retval = NaClPostMessageToNativeWebWorker(bufp, len, &nap_, &channel_); 156 retval = NaClPostMessageToNativeWebWorker(bufp, len, &nap_, &channel_);
155 delete[] bufp; 157 delete[] bufp;
156 } 158 }
157 159
158 void NativeWebWorkerImpl::workerObjectDestroyed() { 160 void NativeWebWorkerImpl::workerObjectDestroyed() {
159 } 161 }
OLDNEW
« no previous file with comments | « chrome/worker/nativewebworker_impl.h ('k') | chrome/worker/webworkerclient_proxy.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698