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

Side by Side Diff: ppapi/proxy/plugin_resource_tracker.cc

Issue 8016008: Make much of the proxy thread-safe with 1 great big lock. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: merge Created 9 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 | « ppapi/proxy/plugin_resource_tracker.h ('k') | ppapi/proxy/ppb_core_proxy.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) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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 "ppapi/proxy/plugin_resource_tracker.h" 5 #include "ppapi/proxy/plugin_resource_tracker.h"
6 6
7 #include "base/logging.h" 7 #include "base/logging.h"
8 #include "base/memory/singleton.h" 8 #include "base/memory/singleton.h"
9 #include "ppapi/proxy/plugin_dispatcher.h" 9 #include "ppapi/proxy/plugin_dispatcher.h"
10 #include "ppapi/proxy/ppapi_messages.h" 10 #include "ppapi/proxy/ppapi_messages.h"
11 #include "ppapi/proxy/serialized_var.h" 11 #include "ppapi/proxy/serialized_var.h"
12 #include "ppapi/shared_impl/proxy_lock.h"
12 #include "ppapi/shared_impl/resource.h" 13 #include "ppapi/shared_impl/resource.h"
13 #include "ppapi/shared_impl/tracker_base.h" 14 #include "ppapi/shared_impl/tracker_base.h"
14 #include "ppapi/shared_impl/var.h" 15 #include "ppapi/shared_impl/var.h"
15 16
16 namespace ppapi { 17 namespace ppapi {
17 namespace proxy { 18 namespace proxy {
18 19
19 namespace { 20 namespace {
20 21
21 // When non-NULL, this object overrides the ResourceTrackerSingleton. 22 // When non-NULL, this object overrides the ResourceTrackerSingleton.
22 PluginResourceTracker* g_resource_tracker_override = NULL; 23 PluginResourceTracker* g_resource_tracker_override = NULL;
23 24
24 TrackerBase* GetTrackerBase() { 25 TrackerBase* GetTrackerBase() {
25 return PluginResourceTracker::GetInstance(); 26 return PluginResourceTracker::GetInstance();
26 } 27 }
27 28
28 } // namespace 29 } // namespace
29 30
30 PluginResourceTracker::PluginResourceTracker() 31 PluginResourceTracker::PluginResourceTracker()
31 : var_tracker_test_override_(NULL) { 32 : var_tracker_test_override_(NULL) {
33 #ifdef ENABLE_PEPPER_THREADING
34 // Set the global proxy lock, since the plugin-side of the proxy needs to be
35 // synchronized.
36 ppapi::ProxyLock::Set(&proxy_lock_);
37 #endif
32 } 38 }
33 39
34 PluginResourceTracker::~PluginResourceTracker() { 40 PluginResourceTracker::~PluginResourceTracker() {
41 #ifdef ENABLE_PEPPER_THREADING
42 ppapi::ProxyLock::Reset();
43 #endif
35 } 44 }
36 45
37 // static 46 // static
38 void PluginResourceTracker::SetInstanceForTest(PluginResourceTracker* tracker) { 47 void PluginResourceTracker::SetInstanceForTest(PluginResourceTracker* tracker) {
39 g_resource_tracker_override = tracker; 48 g_resource_tracker_override = tracker;
40 } 49 }
41 50
42 // static 51 // static
43 PluginResourceTracker* PluginResourceTracker::GetInstance() { 52 PluginResourceTracker* PluginResourceTracker::GetInstance() {
44 if (g_resource_tracker_override) 53 if (g_resource_tracker_override)
(...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after
106 // the instance was destroyed. In that case the browser-side resource has 115 // the instance was destroyed. In that case the browser-side resource has
107 // already been freed correctly on the browser side. 116 // already been freed correctly on the browser side.
108 dispatcher->Send(new PpapiHostMsg_PPBCore_ReleaseResource( 117 dispatcher->Send(new PpapiHostMsg_PPBCore_ReleaseResource(
109 INTERFACE_ID_PPB_CORE, object->host_resource())); 118 INTERFACE_ID_PPB_CORE, object->host_resource()));
110 } 119 }
111 } 120 }
112 } 121 }
113 122
114 } // namespace proxy 123 } // namespace proxy
115 } // namespace ppapi 124 } // namespace ppapi
OLDNEW
« no previous file with comments | « ppapi/proxy/plugin_resource_tracker.h ('k') | ppapi/proxy/ppb_core_proxy.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698