| OLD | NEW |
| 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" | |
| 22 #include "ppapi/shared_impl/proxy_lock.h" | 21 #include "ppapi/shared_impl/proxy_lock.h" |
| 23 #include "ppapi/shared_impl/time_conversion.h" | 22 #include "ppapi/shared_impl/time_conversion.h" |
| 24 | 23 |
| 25 namespace ppapi { | 24 namespace ppapi { |
| 26 namespace proxy { | 25 namespace proxy { |
| 27 | 26 |
| 28 namespace { | 27 namespace { |
| 29 | 28 |
| 30 base::MessageLoopProxy* GetMainThreadMessageLoop() { | 29 base::MessageLoopProxy* GetMainThreadMessageLoop() { |
| 31 static scoped_refptr<base::MessageLoopProxy> proxy( | 30 static scoped_refptr<base::MessageLoopProxy> proxy( |
| 32 base::MessageLoopProxy::current()); | 31 base::MessageLoopProxy::current()); |
| 33 return proxy.get(); | 32 return proxy.get(); |
| 34 } | 33 } |
| 35 | 34 |
| 36 void AddRefResource(PP_Resource resource) { | 35 void AddRefResource(PP_Resource resource) { |
| 37 ppapi::ProxyAutoLock lock; | 36 ppapi::ProxyAutoLock lock; |
| 38 PpapiGlobals::Get()->GetResourceTracker()->AddRefResource(resource); | 37 PluginResourceTracker::GetInstance()->AddRefResource(resource); |
| 39 } | 38 } |
| 40 | 39 |
| 41 void ReleaseResource(PP_Resource resource) { | 40 void ReleaseResource(PP_Resource resource) { |
| 42 ppapi::ProxyAutoLock lock; | 41 ppapi::ProxyAutoLock lock; |
| 43 PpapiGlobals::Get()->GetResourceTracker()->ReleaseResource(resource); | 42 PluginResourceTracker::GetInstance()->ReleaseResource(resource); |
| 44 } | 43 } |
| 45 | 44 |
| 46 double GetTime() { | 45 double GetTime() { |
| 47 return TimeToPPTime(base::Time::Now()); | 46 return TimeToPPTime(base::Time::Now()); |
| 48 } | 47 } |
| 49 | 48 |
| 50 double GetTimeTicks() { | 49 double GetTimeTicks() { |
| 51 return TimeTicksToPPTimeTicks(base::TimeTicks::Now()); | 50 return TimeTicksToPPTimeTicks(base::TimeTicks::Now()); |
| 52 } | 51 } |
| 53 | 52 |
| (...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 115 void PPB_Core_Proxy::OnMsgAddRefResource(const HostResource& resource) { | 114 void PPB_Core_Proxy::OnMsgAddRefResource(const HostResource& resource) { |
| 116 ppb_core_impl_->AddRefResource(resource.host_resource()); | 115 ppb_core_impl_->AddRefResource(resource.host_resource()); |
| 117 } | 116 } |
| 118 | 117 |
| 119 void PPB_Core_Proxy::OnMsgReleaseResource(const HostResource& resource) { | 118 void PPB_Core_Proxy::OnMsgReleaseResource(const HostResource& resource) { |
| 120 ppb_core_impl_->ReleaseResource(resource.host_resource()); | 119 ppb_core_impl_->ReleaseResource(resource.host_resource()); |
| 121 } | 120 } |
| 122 | 121 |
| 123 } // namespace proxy | 122 } // namespace proxy |
| 124 } // namespace ppapi | 123 } // namespace ppapi |
| OLD | NEW |