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

Side by Side Diff: webkit/default_plugin/plugin_impl.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_impl.h" 5 #include "webkit/default_plugin/plugin_impl.h"
6 6
7 #include <shellapi.h> 7 #include <shellapi.h>
8 8
9 #include "base/file_util.h" 9 #include "base/file_util.h"
10 #include "base/path_service.h" 10 #include "base/path_service.h"
(...skipping 21 matching lines...) Expand all
32 mode_(mode), 32 mode_(mode),
33 plugin_install_stream_(NULL), 33 plugin_install_stream_(NULL),
34 plugin_installer_state_(PluginInstallerStateUndefined), 34 plugin_installer_state_(PluginInstallerStateUndefined),
35 enable_click_(false), 35 enable_click_(false),
36 icon_(NULL), 36 icon_(NULL),
37 bold_font_(NULL), 37 bold_font_(NULL),
38 regular_font_(NULL), 38 regular_font_(NULL),
39 underline_font_(NULL), 39 underline_font_(NULL),
40 tooltip_(NULL), 40 tooltip_(NULL),
41 activex_installer_(NULL), 41 activex_installer_(NULL),
42 installation_job_monitor_thread_(new PluginInstallationJobMonitorThread()) ,
jeremy 2009/01/26 23:00:34 >80 chars
John Grabowski 2009/01/27 00:31:25 Fixed
42 plugin_database_handler_(*this), 43 plugin_database_handler_(*this),
43 plugin_download_url_for_display_(false) { 44 plugin_download_url_for_display_(false) {
44 } 45 }
45 46
46 PluginInstallerImpl::~PluginInstallerImpl() { 47 PluginInstallerImpl::~PluginInstallerImpl() {
47 installation_job_monitor_thread_.Stop(); 48 installation_job_monitor_thread_->Stop();
48 49
49 if (bold_font_) 50 if (bold_font_)
50 ::DeleteObject(bold_font_); 51 ::DeleteObject(bold_font_);
51 52
52 if (underline_font_) 53 if (underline_font_)
53 ::DeleteObject(underline_font_); 54 ::DeleteObject(underline_font_);
54 55
55 if (activex_installer_) { 56 if (activex_installer_) {
56 activex_installer_->Cleanup(); 57 activex_installer_->Cleanup();
57 activex_installer_->Release(); 58 activex_installer_->Release();
(...skipping 12 matching lines...) Expand all
70 71
71 // The clsid without the {} parentheses. 72 // The clsid without the {} parentheses.
72 std::string raw_activex_clsid; 73 std::string raw_activex_clsid;
73 if (!ParseInstantiationArguments(mime_type, instance, argc, argn, argv, 74 if (!ParseInstantiationArguments(mime_type, instance, argc, argn, argv,
74 &raw_activex_clsid)) { 75 &raw_activex_clsid)) {
75 DLOG(ERROR) << "Incorrect arguments passed to plugin"; 76 DLOG(ERROR) << "Incorrect arguments passed to plugin";
76 NOTREACHED(); 77 NOTREACHED();
77 return false; 78 return false;
78 } 79 }
79 80
80 if (!installation_job_monitor_thread_.Initialize()) { 81 if (!installation_job_monitor_thread_->Initialize()) {
81 DLOG(ERROR) << "Failed to initialize plugin install job"; 82 DLOG(ERROR) << "Failed to initialize plugin install job";
82 NOTREACHED(); 83 NOTREACHED();
83 return false; 84 return false;
84 } 85 }
85 86
86 InitializeResources(module_handle); 87 InitializeResources(module_handle);
87 88
88 if (is_activex_) { 89 if (is_activex_) {
89 // If the codebase is not from a whitelisted website, we do not allow 90 // If the codebase is not from a whitelisted website, we do not allow
90 // download. 91 // download.
(...skipping 237 matching lines...) Expand 10 before | Expand all | Expand 10 after
328 329
329 if (IsWindow()) { 330 if (IsWindow()) {
330 ::GetClientRect(parent_window, &parent_rect); 331 ::GetClientRect(parent_window, &parent_rect);
331 SetWindowPos(NULL, &parent_rect, SWP_SHOWWINDOW); 332 SetWindowPos(NULL, &parent_rect, SWP_SHOWWINDOW);
332 return true; 333 return true;
333 } 334 }
334 // First time in -- no window created by plugin yet. 335 // First time in -- no window created by plugin yet.
335 ::GetClientRect(parent_window, &parent_rect); 336 ::GetClientRect(parent_window, &parent_rect);
336 Create(parent_window, parent_rect, NULL, WS_CHILD | WS_BORDER); 337 Create(parent_window, parent_rect, NULL, WS_CHILD | WS_BORDER);
337 DCHECK(IsWindow()); 338 DCHECK(IsWindow());
338 installation_job_monitor_thread_.set_plugin_window(m_hWnd); 339 installation_job_monitor_thread_->set_plugin_window(m_hWnd);
339 340
340 CreateToolTip(); 341 CreateToolTip();
341 UpdateToolTip(); 342 UpdateToolTip();
342 343
343 UpdateWindow(); 344 UpdateWindow();
344 ShowWindow(SW_SHOW); 345 ShowWindow(SW_SHOW);
345 346
346 return true; 347 return true;
347 } 348 }
348 349
(...skipping 281 matching lines...) Expand 10 before | Expand all | Expand 10 after
630 if (!ShellExecuteEx(&shell_execute_info)) { 631 if (!ShellExecuteEx(&shell_execute_info)) {
631 DLOG(WARNING) << "Failed to launch plugin installer " 632 DLOG(WARNING) << "Failed to launch plugin installer "
632 << file_path.c_str() << " Error " 633 << file_path.c_str() << " Error "
633 << ::GetLastError(); 634 << ::GetLastError();
634 set_plugin_installer_state(PluginInstallerLaunchFailure); 635 set_plugin_installer_state(PluginInstallerLaunchFailure);
635 DisplayStatus(IDS_DEFAULT_PLUGIN_INSTALLATION_FAILED_MSG); 636 DisplayStatus(IDS_DEFAULT_PLUGIN_INSTALLATION_FAILED_MSG);
636 NOTREACHED(); 637 NOTREACHED();
637 } else { 638 } else {
638 DLOG(INFO) << "Successfully launched plugin installer"; 639 DLOG(INFO) << "Successfully launched plugin installer";
639 set_plugin_installer_state(PluginInstallerLaunchSuccess); 640 set_plugin_installer_state(PluginInstallerLaunchSuccess);
640 installation_job_monitor_thread_.AssignProcessToJob( 641 installation_job_monitor_thread_->AssignProcessToJob(
641 shell_execute_info.hProcess); 642 shell_execute_info.hProcess);
642 DisplayStatus(IDS_DEFAULT_PLUGIN_REFRESH_PLUGIN_MSG); 643 DisplayStatus(IDS_DEFAULT_PLUGIN_REFRESH_PLUGIN_MSG);
643 enable_click_ = true; 644 enable_click_ = true;
644 RefreshDisplay(); 645 RefreshDisplay();
645 } 646 }
646 } 647 }
647 return 0; 648 return 0;
648 } 649 }
649 650
650 LRESULT PluginInstallerImpl::OnActiveXInstallResult(UINT message, 651 LRESULT PluginInstallerImpl::OnActiveXInstallResult(UINT message,
(...skipping 96 matching lines...) Expand 10 before | Expand all | Expand 10 after
747 } 748 }
748 749
749 void PluginInstallerImpl::NotifyPluginStatus(int status) { 750 void PluginInstallerImpl::NotifyPluginStatus(int status) {
750 default_plugin::g_browser->getvalue( 751 default_plugin::g_browser->getvalue(
751 instance_, 752 instance_,
752 static_cast<NPNVariable>( 753 static_cast<NPNVariable>(
753 default_plugin::kMissingPluginStatusStart + status), 754 default_plugin::kMissingPluginStatusStart + status),
754 NULL); 755 NULL);
755 } 756 }
756 757
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698