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

Side by Side Diff: webkit/default_plugin/plugin_install_job_monitor.cc

Issue 18824: thread.cc race fix take 2 (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 11 years, 10 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
OLDNEW
1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2006-2008 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 "webkit/default_plugin/plugin_install_job_monitor.h" 5 #include "webkit/default_plugin/plugin_install_job_monitor.h"
6 6
7 #include "webkit/default_plugin/plugin_impl.h" 7 #include "webkit/default_plugin/plugin_impl.h"
8 8
9 PluginInstallationJobMonitorThread::PluginInstallationJobMonitorThread() 9 PluginInstallationJobMonitorThread::PluginInstallationJobMonitorThread()
10 : Thread("Chrome plugin install thread"), 10 : Thread("Chrome plugin install thread"),
(...skipping 18 matching lines...) Expand all
29 DLOG(ERROR) << "Failed to create plugin install job. Error = " 29 DLOG(ERROR) << "Failed to create plugin install job. Error = "
30 << ::GetLastError(); 30 << ::GetLastError();
31 NOTREACHED(); 31 NOTREACHED();
32 return false; 32 return false;
33 } 33 }
34 34
35 return Start(); 35 return Start();
36 } 36 }
37 37
38 void PluginInstallationJobMonitorThread::Init() { 38 void PluginInstallationJobMonitorThread::Init() {
39 this->message_loop()->PostTask(FROM_HERE,
40 NewRunnableMethod(this,
41 &PluginInstallationJobMonitorThread::WaitForJobThread));
42 }
43
44 void PluginInstallationJobMonitorThread::WaitForJobThread() {
39 if (!install_job_) { 45 if (!install_job_) {
40 DLOG(WARNING) << "Invalid job information"; 46 DLOG(WARNING) << "Invalid job information";
41 NOTREACHED(); 47 NOTREACHED();
42 return; 48 return;
43 } 49 }
44 50
45 DCHECK(install_job_completion_port_ == NULL); 51 DCHECK(install_job_completion_port_ == NULL);
46 52
47 install_job_completion_port_ = 53 install_job_completion_port_ =
48 ::CreateIoCompletionPort(INVALID_HANDLE_VALUE, NULL, 54 ::CreateIoCompletionPort(INVALID_HANDLE_VALUE, NULL,
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after
91 ::CloseHandle(install_job_completion_port_); 97 ::CloseHandle(install_job_completion_port_);
92 install_job_completion_port_ = NULL; 98 install_job_completion_port_ = NULL;
93 } 99 }
94 100
95 bool PluginInstallationJobMonitorThread::AssignProcessToJob( 101 bool PluginInstallationJobMonitorThread::AssignProcessToJob(
96 HANDLE process_handle) { 102 HANDLE process_handle) {
97 BOOL result = AssignProcessToJobObject(install_job_, process_handle); 103 BOOL result = AssignProcessToJobObject(install_job_, process_handle);
98 return result ? true : false; 104 return result ? true : false;
99 } 105 }
100 106
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698