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

Side by Side Diff: ppapi/native_client/src/shared/ppapi_proxy/plugin_resource_tracker.cc

Issue 8574027: Remove 1 exit time destructor from ppapi, and possibly fix a bug. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: . Created 9 years, 1 month 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) 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 "native_client/src/shared/ppapi_proxy/plugin_resource_tracker.h" 5 #include "native_client/src/shared/ppapi_proxy/plugin_resource_tracker.h"
6 6
7 #include <limits> 7 #include <limits>
8 #include <set> 8 #include <set>
9 9
10 #include "base/basictypes.h"
10 #include "native_client/src/include/nacl_macros.h" 11 #include "native_client/src/include/nacl_macros.h"
11 #include "native_client/src/include/portability.h" 12 #include "native_client/src/include/portability.h"
12 #include "native_client/src/shared/ppapi_proxy/plugin_globals.h" 13 #include "native_client/src/shared/ppapi_proxy/plugin_globals.h"
13 #include "native_client/src/shared/ppapi_proxy/plugin_resource.h" 14 #include "native_client/src/shared/ppapi_proxy/plugin_resource.h"
14 #include "native_client/src/shared/ppapi_proxy/untrusted/srpcgen/ppb_rpc.h" 15 #include "native_client/src/shared/ppapi_proxy/untrusted/srpcgen/ppb_rpc.h"
15 #include "ppapi/c/pp_resource.h" 16 #include "ppapi/c/pp_resource.h"
16 17
17 namespace ppapi_proxy { 18 namespace ppapi_proxy {
18 19
20 // static
21 PluginResourceTracker* PluginResourceTracker::Get() {
22 CR_DEFINE_STATIC_LOCAL(PluginResourceTracker, tracker, ());
noelallen1 2011/11/16 18:22:40 Does this need to be some form of LazyInstance? I
Nico 2011/11/16 18:25:57 No; it's the same as a normal static except that i
23 return &tracker;
24 }
25
19 PluginResourceTracker::ResourceAndRefCounts::ResourceAndRefCounts( 26 PluginResourceTracker::ResourceAndRefCounts::ResourceAndRefCounts(
20 PluginResource* r, size_t browser_count) 27 PluginResource* r, size_t browser_count)
21 : resource(r), browser_refcount(browser_count), plugin_refcount(1) { 28 : resource(r), browser_refcount(browser_count), plugin_refcount(1) {
22 } 29 }
23 30
24 PluginResourceTracker::ResourceAndRefCounts::~ResourceAndRefCounts() { 31 PluginResourceTracker::ResourceAndRefCounts::~ResourceAndRefCounts() {
25 } 32 }
26 33
27 scoped_refptr<PluginResource> PluginResourceTracker::GetExistingResource( 34 scoped_refptr<PluginResource> PluginResourceTracker::GetExistingResource(
28 PP_Resource res) const { 35 PP_Resource res) const {
(...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after
92 // Release all browser references. 99 // Release all browser references.
93 if (res && (browser_refcount > 0)) { 100 if (res && (browser_refcount > 0)) {
94 NaClSrpcChannel* channel = ppapi_proxy::GetMainSrpcChannel(); 101 NaClSrpcChannel* channel = ppapi_proxy::GetMainSrpcChannel();
95 PpbCoreRpcClient::ReleaseResourceMultipleTimes(channel, res, 102 PpbCoreRpcClient::ReleaseResourceMultipleTimes(channel, res,
96 browser_refcount); 103 browser_refcount);
97 } 104 }
98 } 105 }
99 106
100 } // namespace ppapi_proxy 107 } // namespace ppapi_proxy
101 108
OLDNEW
« no previous file with comments | « ppapi/native_client/src/shared/ppapi_proxy/plugin_resource_tracker.h ('k') | ppapi/ppapi_proxy.gypi » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698