| 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/debug/trace_event.h" | 9 #include "base/debug/trace_event.h" |
| 10 #include "base/logging.h" | 10 #include "base/logging.h" |
| 11 #include "base/message_loop.h" | 11 #include "base/message_loop.h" |
| 12 #include "base/message_loop_proxy.h" | 12 #include "base/message_loop_proxy.h" |
| 13 #include "base/time.h" | 13 #include "base/time.h" |
| 14 #include "ppapi/c/pp_completion_callback.h" | 14 #include "ppapi/c/pp_completion_callback.h" |
| 15 #include "ppapi/c/pp_resource.h" | 15 #include "ppapi/c/pp_resource.h" |
| 16 #include "ppapi/c/ppb_core.h" | 16 #include "ppapi/c/ppb_core.h" |
| 17 #include "ppapi/proxy/plugin_dispatcher.h" | 17 #include "ppapi/proxy/plugin_dispatcher.h" |
| 18 #include "ppapi/proxy/plugin_resource_tracker.h" | 18 #include "ppapi/proxy/plugin_resource_tracker.h" |
| 19 #include "ppapi/proxy/ppapi_messages.h" | 19 #include "ppapi/proxy/ppapi_messages.h" |
| 20 #include "ppapi/shared_impl/time_conversion.h" | 20 #include "ppapi/shared_impl/time_conversion.h" |
| 21 | 21 |
| 22 using ppapi::HostResource; |
| 22 using ppapi::TimeToPPTime; | 23 using ppapi::TimeToPPTime; |
| 23 using ppapi::TimeTicksToPPTimeTicks; | 24 using ppapi::TimeTicksToPPTimeTicks; |
| 24 | 25 |
| 25 namespace pp { | 26 namespace pp { |
| 26 namespace proxy { | 27 namespace proxy { |
| 27 | 28 |
| 28 namespace { | 29 namespace { |
| 29 | 30 |
| 30 base::MessageLoopProxy* GetMainThreadMessageLoop() { | 31 base::MessageLoopProxy* GetMainThreadMessageLoop() { |
| 31 static scoped_refptr<base::MessageLoopProxy> proxy( | 32 static scoped_refptr<base::MessageLoopProxy> proxy( |
| (...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 111 IPC_MESSAGE_HANDLER(PpapiHostMsg_PPBCore_AddRefResource, | 112 IPC_MESSAGE_HANDLER(PpapiHostMsg_PPBCore_AddRefResource, |
| 112 OnMsgAddRefResource) | 113 OnMsgAddRefResource) |
| 113 IPC_MESSAGE_HANDLER(PpapiHostMsg_PPBCore_ReleaseResource, | 114 IPC_MESSAGE_HANDLER(PpapiHostMsg_PPBCore_ReleaseResource, |
| 114 OnMsgReleaseResource) | 115 OnMsgReleaseResource) |
| 115 IPC_MESSAGE_UNHANDLED(handled = false) | 116 IPC_MESSAGE_UNHANDLED(handled = false) |
| 116 IPC_END_MESSAGE_MAP() | 117 IPC_END_MESSAGE_MAP() |
| 117 // TODO(brettw) handle bad messages! | 118 // TODO(brettw) handle bad messages! |
| 118 return handled; | 119 return handled; |
| 119 } | 120 } |
| 120 | 121 |
| 121 void PPB_Core_Proxy::OnMsgAddRefResource(HostResource resource) { | 122 void PPB_Core_Proxy::OnMsgAddRefResource(const HostResource& resource) { |
| 122 ppb_core_target()->AddRefResource(resource.host_resource()); | 123 ppb_core_target()->AddRefResource(resource.host_resource()); |
| 123 } | 124 } |
| 124 | 125 |
| 125 void PPB_Core_Proxy::OnMsgReleaseResource(HostResource resource) { | 126 void PPB_Core_Proxy::OnMsgReleaseResource(const HostResource& resource) { |
| 126 ppb_core_target()->ReleaseResource(resource.host_resource()); | 127 ppb_core_target()->ReleaseResource(resource.host_resource()); |
| 127 } | 128 } |
| 128 | 129 |
| 129 } // namespace proxy | 130 } // namespace proxy |
| 130 } // namespace pp | 131 } // namespace pp |
| OLD | NEW |