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

Side by Side Diff: content/ppapi_plugin/ppapi_thread.cc

Issue 568793002: PPAPI: Fix GetBrowserInterface race conditions (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Review comments Created 6 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
« no previous file with comments | « no previous file | ppapi/nacl_irt/plugin_main.cc » ('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) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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/ppapi_plugin/ppapi_thread.h" 5 #include "content/ppapi_plugin/ppapi_thread.h"
6 6
7 #include <limits> 7 #include <limits>
8 8
9 #include "base/command_line.h" 9 #include "base/command_line.h"
10 #include "base/cpu.h" 10 #include "base/cpu.h"
(...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after
100 typedef int32_t (*InitializeBrokerFunc) 100 typedef int32_t (*InitializeBrokerFunc)
101 (PP_ConnectInstance_Func* connect_instance_func); 101 (PP_ConnectInstance_Func* connect_instance_func);
102 102
103 PpapiThread::PpapiThread(const CommandLine& command_line, bool is_broker) 103 PpapiThread::PpapiThread(const CommandLine& command_line, bool is_broker)
104 : is_broker_(is_broker), 104 : is_broker_(is_broker),
105 connect_instance_func_(NULL), 105 connect_instance_func_(NULL),
106 local_pp_module_( 106 local_pp_module_(
107 base::RandInt(0, std::numeric_limits<PP_Module>::max())), 107 base::RandInt(0, std::numeric_limits<PP_Module>::max())),
108 next_plugin_dispatcher_id_(1) { 108 next_plugin_dispatcher_id_(1) {
109 ppapi::proxy::PluginGlobals* globals = ppapi::proxy::PluginGlobals::Get(); 109 ppapi::proxy::PluginGlobals* globals = ppapi::proxy::PluginGlobals::Get();
110 globals->set_plugin_proxy_delegate(this); 110 globals->SetPluginProxyDelegate(this);
111 globals->set_command_line( 111 globals->set_command_line(
112 command_line.GetSwitchValueASCII(switches::kPpapiFlashArgs)); 112 command_line.GetSwitchValueASCII(switches::kPpapiFlashArgs));
113 113
114 webkit_platform_support_.reset(new PpapiWebKitPlatformSupportImpl); 114 webkit_platform_support_.reset(new PpapiWebKitPlatformSupportImpl);
115 blink::initialize(webkit_platform_support_.get()); 115 blink::initialize(webkit_platform_support_.get());
116 116
117 if (!is_broker_) { 117 if (!is_broker_) {
118 channel()->AddFilter( 118 channel()->AddFilter(
119 new ppapi::proxy::PluginMessageFilter( 119 new ppapi::proxy::PluginMessageFilter(
120 NULL, globals->resource_reply_thread_registrar())); 120 NULL, globals->resource_reply_thread_registrar()));
121 } 121 }
122 } 122 }
123 123
124 PpapiThread::~PpapiThread() { 124 PpapiThread::~PpapiThread() {
125 } 125 }
126 126
127 void PpapiThread::Shutdown() { 127 void PpapiThread::Shutdown() {
128 ChildThread::Shutdown(); 128 ChildThread::Shutdown();
129 129
130 ppapi::proxy::PluginGlobals::Get()->set_plugin_proxy_delegate(NULL); 130 ppapi::proxy::PluginGlobals::Get()->ResetPluginProxyDelegate();
131 if (plugin_entry_points_.shutdown_module) 131 if (plugin_entry_points_.shutdown_module)
132 plugin_entry_points_.shutdown_module(); 132 plugin_entry_points_.shutdown_module();
133 webkit_platform_support_->Shutdown(); 133 webkit_platform_support_->Shutdown();
134 blink::shutdown(); 134 blink::shutdown();
135 } 135 }
136 136
137 bool PpapiThread::Send(IPC::Message* msg) { 137 bool PpapiThread::Send(IPC::Message* msg) {
138 // Allow access from multiple threads. 138 // Allow access from multiple threads.
139 if (base::MessageLoop::current() == message_loop()) 139 if (base::MessageLoop::current() == message_loop())
140 return ChildThread::Send(msg); 140 return ChildThread::Send(msg);
(...skipping 402 matching lines...) Expand 10 before | Expand all | Expand 10 after
543 std::string("Plugin.Ppapi") + (is_broker_ ? "Broker" : "Plugin") + 543 std::string("Plugin.Ppapi") + (is_broker_ ? "Broker" : "Plugin") +
544 "LoadErrorCode_" + path.BaseName().MaybeAsASCII(); 544 "LoadErrorCode_" + path.BaseName().MaybeAsASCII();
545 545
546 // For sparse histograms, we can use the macro, as it does not incorporate a 546 // For sparse histograms, we can use the macro, as it does not incorporate a
547 // static. 547 // static.
548 UMA_HISTOGRAM_SPARSE_SLOWLY(histogram_name, error.code); 548 UMA_HISTOGRAM_SPARSE_SLOWLY(histogram_name, error.code);
549 #endif 549 #endif
550 } 550 }
551 551
552 } // namespace content 552 } // namespace content
OLDNEW
« no previous file with comments | « no previous file | ppapi/nacl_irt/plugin_main.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698