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

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

Issue 266036: Fix another race condition on worker process shutdown that results in use-aft... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 11 years, 2 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.cc ('k') | tools/valgrind/memcheck/suppressions.txt » ('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/webworkerclient_proxy.h" 5 #include "chrome/worker/webworkerclient_proxy.h"
6 6
7 #include "base/command_line.h" 7 #include "base/command_line.h"
8 #include "chrome/common/child_process.h" 8 #include "chrome/common/child_process.h"
9 #include "chrome/common/chrome_switches.h" 9 #include "chrome/common/chrome_switches.h"
10 #include "chrome/common/webmessageportchannel_impl.h" 10 #include "chrome/common/webmessageportchannel_impl.h"
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after
69 impl_ = NativeWebWorkerImpl::create(this); 69 impl_ = NativeWebWorkerImpl::create(this);
70 } else { 70 } else {
71 // Launch a JavaScript worker. 71 // Launch a JavaScript worker.
72 impl_ = WebWorker::create(this); 72 impl_ = WebWorker::create(this);
73 } 73 }
74 WorkerThread::current()->AddRoute(route_id_, this); 74 WorkerThread::current()->AddRoute(route_id_, this);
75 ChildProcess::current()->AddRefProcess(); 75 ChildProcess::current()->AddRefProcess();
76 } 76 }
77 77
78 WebWorkerClientProxy::~WebWorkerClientProxy() { 78 WebWorkerClientProxy::~WebWorkerClientProxy() {
79 impl_->clientDestroyed();
79 WorkerThread::current()->RemoveRoute(route_id_); 80 WorkerThread::current()->RemoveRoute(route_id_);
80 ChildProcess::current()->ReleaseProcess(); 81 ChildProcess::current()->ReleaseProcess();
81 } 82 }
82 83
83 void WebWorkerClientProxy::postMessageToWorkerObject( 84 void WebWorkerClientProxy::postMessageToWorkerObject(
84 const WebString& message, 85 const WebString& message,
85 const WebMessagePortChannelArray& channels) { 86 const WebMessagePortChannelArray& channels) {
86 std::vector<int> message_port_ids(channels.size()); 87 std::vector<int> message_port_ids(channels.size());
87 std::vector<int> routing_ids(channels.size()); 88 std::vector<int> routing_ids(channels.size());
88 for (size_t i = 0; i < channels.size(); ++i) { 89 for (size_t i = 0; i < channels.size(); ++i) {
(...skipping 98 matching lines...) Expand 10 before | Expand all | Expand 10 after
187 const std::vector<int>& sent_message_port_ids, 188 const std::vector<int>& sent_message_port_ids,
188 const std::vector<int>& new_routing_ids) { 189 const std::vector<int>& new_routing_ids) {
189 WebMessagePortChannelArray channels(sent_message_port_ids.size()); 190 WebMessagePortChannelArray channels(sent_message_port_ids.size());
190 for (size_t i = 0; i < sent_message_port_ids.size(); i++) { 191 for (size_t i = 0; i < sent_message_port_ids.size(); i++) {
191 channels[i] = new WebMessagePortChannelImpl( 192 channels[i] = new WebMessagePortChannelImpl(
192 new_routing_ids[i], sent_message_port_ids[i]); 193 new_routing_ids[i], sent_message_port_ids[i]);
193 } 194 }
194 195
195 impl_->postMessageToWorkerContext(message, channels); 196 impl_->postMessageToWorkerContext(message, channels);
196 } 197 }
OLDNEW
« no previous file with comments | « chrome/worker/nativewebworker_impl.cc ('k') | tools/valgrind/memcheck/suppressions.txt » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698