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 "content/renderer/pepper/host_var_tracker.h" | 5 #include "content/renderer/pepper/host_var_tracker.h" |
6 | 6 |
7 #include "base/logging.h" | 7 #include "base/logging.h" |
8 #include "content/renderer/pepper/host_array_buffer_var.h" | 8 #include "content/renderer/pepper/host_array_buffer_var.h" |
9 #include "content/renderer/pepper/host_resource_var.h" | 9 #include "content/renderer/pepper/host_resource_var.h" |
10 #include "content/renderer/pepper/npobject_var.h" | 10 #include "content/renderer/pepper/npobject_var.h" |
(...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
96 | 96 |
97 int HostVarTracker::GetLiveNPObjectVarsForInstance(PP_Instance instance) const { | 97 int HostVarTracker::GetLiveNPObjectVarsForInstance(PP_Instance instance) const { |
98 CheckThreadingPreconditions(); | 98 CheckThreadingPreconditions(); |
99 | 99 |
100 InstanceMap::const_iterator found = instance_map_.find(instance); | 100 InstanceMap::const_iterator found = instance_map_.find(instance); |
101 if (found == instance_map_.end()) | 101 if (found == instance_map_.end()) |
102 return 0; | 102 return 0; |
103 return static_cast<int>(found->second->size()); | 103 return static_cast<int>(found->second->size()); |
104 } | 104 } |
105 | 105 |
| 106 PP_Var HostVarTracker::MakeResourcePPVarFromMessage( |
| 107 PP_Instance instance, |
| 108 const IPC::Message& creation_message, |
| 109 int pending_renderer_id, |
| 110 int pending_browser_id) { |
| 111 // On the host side, the creation message is ignored when creating a resource. |
| 112 // Therefore, a call to this function indicates a null resource. Return the |
| 113 // resource 0. |
| 114 return MakeResourcePPVar(0); |
| 115 } |
| 116 |
106 ppapi::ResourceVar* HostVarTracker::MakeResourceVar(PP_Resource pp_resource) { | 117 ppapi::ResourceVar* HostVarTracker::MakeResourceVar(PP_Resource pp_resource) { |
107 return new HostResourceVar(pp_resource); | 118 return new HostResourceVar(pp_resource); |
108 } | 119 } |
109 | 120 |
110 void HostVarTracker::DidDeleteInstance(PP_Instance instance) { | 121 void HostVarTracker::DidDeleteInstance(PP_Instance instance) { |
111 CheckThreadingPreconditions(); | 122 CheckThreadingPreconditions(); |
112 | 123 |
113 InstanceMap::iterator found_instance = instance_map_.find(instance); | 124 InstanceMap::iterator found_instance = instance_map_.find(instance); |
114 if (found_instance == instance_map_.end()) | 125 if (found_instance == instance_map_.end()) |
115 return; // Nothing to do. | 126 return; // Nothing to do. |
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
167 if (it->second.instance != instance) | 178 if (it->second.instance != instance) |
168 return false; | 179 return false; |
169 | 180 |
170 *handle = it->second.handle; | 181 *handle = it->second.handle; |
171 *size_in_bytes = it->second.size_in_bytes; | 182 *size_in_bytes = it->second.size_in_bytes; |
172 shared_memory_map_.erase(it); | 183 shared_memory_map_.erase(it); |
173 return true; | 184 return true; |
174 } | 185 } |
175 | 186 |
176 } // namespace content | 187 } // namespace content |
OLD | NEW |