OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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/cpp/private/instance_private.h" | 5 #include "ppapi/cpp/private/instance_private.h" |
6 | 6 |
| 7 #include "ppapi/c/private/ppb_input_event_private.h" |
7 #include "ppapi/c/private/ppb_instance_private.h" | 8 #include "ppapi/c/private/ppb_instance_private.h" |
8 #include "ppapi/c/private/ppp_instance_private.h" | 9 #include "ppapi/c/private/ppp_instance_private.h" |
9 #include "ppapi/cpp/module_impl.h" | 10 #include "ppapi/cpp/module_impl.h" |
10 #include "ppapi/cpp/private/var_private.h" | 11 #include "ppapi/cpp/private/var_private.h" |
11 | 12 |
12 namespace pp { | 13 namespace pp { |
13 | 14 |
14 namespace { | 15 namespace { |
15 | 16 |
16 template <> const char* interface_name<PPB_Instance_Private>() { | 17 template <> const char* interface_name<PPB_Instance_Private>() { |
17 return PPB_INSTANCE_PRIVATE_INTERFACE; | 18 return PPB_INSTANCE_PRIVATE_INTERFACE; |
18 } | 19 } |
19 | 20 |
| 21 template <> const char* interface_name<PPB_InputEvent_Private>() { |
| 22 return PPB_INPUTEVENT_PRIVATE_INTERFACE; |
| 23 } |
| 24 |
20 PP_Var GetInstanceObject(PP_Instance pp_instance) { | 25 PP_Var GetInstanceObject(PP_Instance pp_instance) { |
21 Module* module_singleton = Module::Get(); | 26 Module* module_singleton = Module::Get(); |
22 if (!module_singleton) | 27 if (!module_singleton) |
23 return Var().Detach(); | 28 return Var().Detach(); |
24 InstancePrivate* instance_private = static_cast<InstancePrivate*>( | 29 InstancePrivate* instance_private = static_cast<InstancePrivate*>( |
25 module_singleton->InstanceForPPInstance(pp_instance)); | 30 module_singleton->InstanceForPPInstance(pp_instance)); |
26 if (!instance_private) | 31 if (!instance_private) |
27 return Var().Detach(); | 32 return Var().Detach(); |
28 return instance_private->GetInstanceObject().Detach(); | 33 return instance_private->GetInstanceObject().Detach(); |
29 } | 34 } |
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
65 VarPrivate InstancePrivate::ExecuteScript(const Var& script, Var* exception) { | 70 VarPrivate InstancePrivate::ExecuteScript(const Var& script, Var* exception) { |
66 if (!has_interface<PPB_Instance_Private>()) | 71 if (!has_interface<PPB_Instance_Private>()) |
67 return VarPrivate(); | 72 return VarPrivate(); |
68 return VarPrivate(PASS_REF, | 73 return VarPrivate(PASS_REF, |
69 get_interface<PPB_Instance_Private>()->ExecuteScript( | 74 get_interface<PPB_Instance_Private>()->ExecuteScript( |
70 pp_instance(), | 75 pp_instance(), |
71 script.pp_var(), | 76 script.pp_var(), |
72 VarPrivate::OutException(exception).get())); | 77 VarPrivate::OutException(exception).get())); |
73 } | 78 } |
74 | 79 |
| 80 void InstancePrivate::StartTrackingLatency(PP_Instance instance) { |
| 81 if (!has_interface<PPB_InputEvent_Private>()) |
| 82 return; |
| 83 return get_interface<PPB_InputEvent_Private>()->StartTrackingLatency( |
| 84 pp_instance()); |
| 85 } |
| 86 |
75 } // namespace pp | 87 } // namespace pp |
OLD | NEW |