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 #ifndef CONTENT_RENDERER_PEPPER_HOST_VAR_TRACKER_H_ | 5 #ifndef CONTENT_RENDERER_PEPPER_HOST_VAR_TRACKER_H_ |
6 #define CONTENT_RENDERER_PEPPER_HOST_VAR_TRACKER_H_ | 6 #define CONTENT_RENDERER_PEPPER_HOST_VAR_TRACKER_H_ |
7 | 7 |
8 #include <map> | 8 #include <map> |
9 | 9 |
10 #include "base/basictypes.h" | 10 #include "base/basictypes.h" |
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
44 void RemoveNPObjectVar(ppapi::NPObjectVar* object_var); | 44 void RemoveNPObjectVar(ppapi::NPObjectVar* object_var); |
45 | 45 |
46 // Looks up a previously registered NPObjectVar for the given NPObject and | 46 // Looks up a previously registered NPObjectVar for the given NPObject and |
47 // instance. Returns NULL if there is no NPObjectVar corresponding to the | 47 // instance. Returns NULL if there is no NPObjectVar corresponding to the |
48 // given NPObject for the given instance. See AddNPObjectVar above. | 48 // given NPObject for the given instance. See AddNPObjectVar above. |
49 ppapi::NPObjectVar* NPObjectVarForNPObject(PP_Instance instance, | 49 ppapi::NPObjectVar* NPObjectVarForNPObject(PP_Instance instance, |
50 NPObject* np_object); | 50 NPObject* np_object); |
51 | 51 |
52 // Returns the number of NPObjectVar's associated with the given instance. | 52 // Returns the number of NPObjectVar's associated with the given instance. |
53 // Returns 0 if the instance isn't known. | 53 // Returns 0 if the instance isn't known. |
54 CONTENT_EXPORT int GetLiveNPObjectVarsForInstance( | 54 CONTENT_EXPORT int GetLiveNPObjectVarsForInstance(PP_Instance instance) const; |
55 PP_Instance instance) const; | |
56 | 55 |
57 // VarTracker public implementation. | 56 // VarTracker public implementation. |
58 virtual PP_Var MakeResourcePPVarFromMessage( | 57 virtual PP_Var MakeResourcePPVarFromMessage( |
59 PP_Instance instance, | 58 PP_Instance instance, |
60 const IPC::Message& creation_message, | 59 const IPC::Message& creation_message, |
61 int pending_renderer_id, | 60 int pending_renderer_id, |
62 int pending_browser_id) OVERRIDE; | 61 int pending_browser_id) OVERRIDE; |
63 virtual ppapi::ResourceVar* MakeResourceVar(PP_Resource pp_resource) OVERRIDE; | 62 virtual ppapi::ResourceVar* MakeResourceVar(PP_Resource pp_resource) OVERRIDE; |
64 virtual void DidDeleteInstance(PP_Instance instance) OVERRIDE; | 63 virtual void DidDeleteInstance(PP_Instance instance) OVERRIDE; |
65 | 64 |
66 virtual int TrackSharedMemoryHandle(PP_Instance instance, | 65 virtual int TrackSharedMemoryHandle(PP_Instance instance, |
67 base::SharedMemoryHandle file, | 66 base::SharedMemoryHandle file, |
68 uint32 size_in_bytes) OVERRIDE; | 67 uint32 size_in_bytes) OVERRIDE; |
69 virtual bool StopTrackingSharedMemoryHandle(int id, | 68 virtual bool StopTrackingSharedMemoryHandle(int id, |
70 PP_Instance instance, | 69 PP_Instance instance, |
71 base::SharedMemoryHandle* handle, | 70 base::SharedMemoryHandle* handle, |
72 uint32* size_in_bytes) OVERRIDE; | 71 uint32* size_in_bytes) OVERRIDE; |
73 | 72 |
74 private: | 73 private: |
75 // VarTracker private implementation. | 74 // VarTracker private implementation. |
76 virtual ppapi::ArrayBufferVar* CreateArrayBuffer( | 75 virtual ppapi::ArrayBufferVar* CreateArrayBuffer(uint32 size_in_bytes) |
77 uint32 size_in_bytes) OVERRIDE; | 76 OVERRIDE; |
78 virtual ppapi::ArrayBufferVar* CreateShmArrayBuffer( | 77 virtual ppapi::ArrayBufferVar* CreateShmArrayBuffer( |
79 uint32 size_in_bytes, base::SharedMemoryHandle handle) OVERRIDE; | 78 uint32 size_in_bytes, |
| 79 base::SharedMemoryHandle handle) OVERRIDE; |
80 | 80 |
81 // Clear the reference count of the given object and remove it from | 81 // Clear the reference count of the given object and remove it from |
82 // live_vars_. | 82 // live_vars_. |
83 void ForceReleaseNPObject(ppapi::NPObjectVar* object_var); | 83 void ForceReleaseNPObject(ppapi::NPObjectVar* object_var); |
84 | 84 |
85 typedef std::map<NPObject*, ppapi::NPObjectVar*> NPObjectToNPObjectVarMap; | 85 typedef std::map<NPObject*, ppapi::NPObjectVar*> NPObjectToNPObjectVarMap; |
86 | 86 |
87 // Lists all known NPObjects, first indexed by the corresponding instance, | 87 // Lists all known NPObjects, first indexed by the corresponding instance, |
88 // then by the NPObject*. This allows us to look up an NPObjectVar given | 88 // then by the NPObject*. This allows us to look up an NPObjectVar given |
89 // these two pieces of information. | 89 // these two pieces of information. |
(...skipping 14 matching lines...) Expand all Loading... |
104 typedef std::map<int, SharedMemoryMapEntry> SharedMemoryMap; | 104 typedef std::map<int, SharedMemoryMapEntry> SharedMemoryMap; |
105 SharedMemoryMap shared_memory_map_; | 105 SharedMemoryMap shared_memory_map_; |
106 uint32_t last_shared_memory_map_id_; | 106 uint32_t last_shared_memory_map_id_; |
107 | 107 |
108 DISALLOW_COPY_AND_ASSIGN(HostVarTracker); | 108 DISALLOW_COPY_AND_ASSIGN(HostVarTracker); |
109 }; | 109 }; |
110 | 110 |
111 } // namespace content | 111 } // namespace content |
112 | 112 |
113 #endif // CONTENT_RENDERER_PEPPER_HOST_VAR_TRACKER_H_ | 113 #endif // CONTENT_RENDERER_PEPPER_HOST_VAR_TRACKER_H_ |
OLD | NEW |