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

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

Issue 8316008: Add a new globals object for PPAPI tracking information. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: 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
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/ppb_core_proxy.h" 5 #include "ppapi/proxy/ppb_core_proxy.h"
6 6
7 #include <stdlib.h> // For malloc 7 #include <stdlib.h> // For malloc
8 8
9 #include "base/bind.h" 9 #include "base/bind.h"
10 #include "base/debug/trace_event.h" 10 #include "base/debug/trace_event.h"
11 #include "base/logging.h" 11 #include "base/logging.h"
12 #include "base/message_loop.h" 12 #include "base/message_loop.h"
13 #include "base/message_loop_proxy.h" 13 #include "base/message_loop_proxy.h"
14 #include "base/time.h" 14 #include "base/time.h"
15 #include "ppapi/c/pp_completion_callback.h" 15 #include "ppapi/c/pp_completion_callback.h"
16 #include "ppapi/c/pp_resource.h" 16 #include "ppapi/c/pp_resource.h"
17 #include "ppapi/c/ppb_core.h" 17 #include "ppapi/c/ppb_core.h"
18 #include "ppapi/proxy/plugin_dispatcher.h" 18 #include "ppapi/proxy/plugin_dispatcher.h"
19 #include "ppapi/proxy/plugin_resource_tracker.h" 19 #include "ppapi/proxy/plugin_resource_tracker.h"
20 #include "ppapi/proxy/ppapi_messages.h" 20 #include "ppapi/proxy/ppapi_messages.h"
21 #include "ppapi/shared_impl/ppapi_globals.h"
21 #include "ppapi/shared_impl/proxy_lock.h" 22 #include "ppapi/shared_impl/proxy_lock.h"
22 #include "ppapi/shared_impl/time_conversion.h" 23 #include "ppapi/shared_impl/time_conversion.h"
23 24
24 namespace ppapi { 25 namespace ppapi {
25 namespace proxy { 26 namespace proxy {
26 27
27 namespace { 28 namespace {
28 29
29 base::MessageLoopProxy* GetMainThreadMessageLoop() { 30 base::MessageLoopProxy* GetMainThreadMessageLoop() {
30 static scoped_refptr<base::MessageLoopProxy> proxy( 31 static scoped_refptr<base::MessageLoopProxy> proxy(
31 base::MessageLoopProxy::current()); 32 base::MessageLoopProxy::current());
32 return proxy.get(); 33 return proxy.get();
33 } 34 }
34 35
35 void AddRefResource(PP_Resource resource) { 36 void AddRefResource(PP_Resource resource) {
36 ppapi::ProxyAutoLock lock; 37 ppapi::ProxyAutoLock lock;
37 PluginResourceTracker::GetInstance()->AddRefResource(resource); 38 PpapiGlobals::Get()->GetResourceTracker()->AddRefResource(resource);
38 } 39 }
39 40
40 void ReleaseResource(PP_Resource resource) { 41 void ReleaseResource(PP_Resource resource) {
41 ppapi::ProxyAutoLock lock; 42 ppapi::ProxyAutoLock lock;
42 PluginResourceTracker::GetInstance()->ReleaseResource(resource); 43 PpapiGlobals::Get()->GetResourceTracker()->ReleaseResource(resource);
43 } 44 }
44 45
45 double GetTime() { 46 double GetTime() {
46 return TimeToPPTime(base::Time::Now()); 47 return TimeToPPTime(base::Time::Now());
47 } 48 }
48 49
49 double GetTimeTicks() { 50 double GetTimeTicks() {
50 return TimeTicksToPPTimeTicks(base::TimeTicks::Now()); 51 return TimeTicksToPPTimeTicks(base::TimeTicks::Now());
51 } 52 }
52 53
(...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after
114 void PPB_Core_Proxy::OnMsgAddRefResource(const HostResource& resource) { 115 void PPB_Core_Proxy::OnMsgAddRefResource(const HostResource& resource) {
115 ppb_core_impl_->AddRefResource(resource.host_resource()); 116 ppb_core_impl_->AddRefResource(resource.host_resource());
116 } 117 }
117 118
118 void PPB_Core_Proxy::OnMsgReleaseResource(const HostResource& resource) { 119 void PPB_Core_Proxy::OnMsgReleaseResource(const HostResource& resource) {
119 ppb_core_impl_->ReleaseResource(resource.host_resource()); 120 ppb_core_impl_->ReleaseResource(resource.host_resource());
120 } 121 }
121 122
122 } // namespace proxy 123 } // namespace proxy
123 } // namespace ppapi 124 } // namespace ppapi
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698