| 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/plugin_var_tracker.h" | 5 #include "ppapi/proxy/plugin_var_tracker.h" |
| 6 | 6 |
| 7 #include "base/memory/ref_counted.h" | 7 #include "base/memory/ref_counted.h" |
| 8 #include "base/memory/singleton.h" | 8 #include "base/memory/singleton.h" |
| 9 #include "ppapi/c/ppb_var.h" | 9 #include "ppapi/c/ppb_var.h" |
| 10 #include "ppapi/proxy/plugin_array_buffer_var.h" | 10 #include "ppapi/proxy/plugin_array_buffer_var.h" |
| (...skipping 217 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 228 | 228 |
| 229 PP_Var PluginVarTracker::GetOrCreateObjectVarID(ProxyObjectVar* object) { | 229 PP_Var PluginVarTracker::GetOrCreateObjectVarID(ProxyObjectVar* object) { |
| 230 // We can't use object->GetPPVar() because we don't want to affect the | 230 // We can't use object->GetPPVar() because we don't want to affect the |
| 231 // refcount, so we have to add everything manually here. | 231 // refcount, so we have to add everything manually here. |
| 232 int32 var_id = object->GetExistingVarID(); | 232 int32 var_id = object->GetExistingVarID(); |
| 233 if (!var_id) { | 233 if (!var_id) { |
| 234 var_id = AddVarInternal(object, ADD_VAR_CREATE_WITH_NO_REFERENCE); | 234 var_id = AddVarInternal(object, ADD_VAR_CREATE_WITH_NO_REFERENCE); |
| 235 object->AssignVarID(var_id); | 235 object->AssignVarID(var_id); |
| 236 } | 236 } |
| 237 | 237 |
| 238 PP_Var ret; | 238 PP_Var ret = { PP_VARTYPE_OBJECT }; |
| 239 ret.type = PP_VARTYPE_OBJECT; | |
| 240 ret.value.as_id = var_id; | 239 ret.value.as_id = var_id; |
| 241 return ret; | 240 return ret; |
| 242 } | 241 } |
| 243 | 242 |
| 244 void PluginVarTracker::SendAddRefObjectMsg( | 243 void PluginVarTracker::SendAddRefObjectMsg( |
| 245 const ProxyObjectVar& proxy_object) { | 244 const ProxyObjectVar& proxy_object) { |
| 246 int unused; | 245 int unused; |
| 247 proxy_object.dispatcher()->Send(new PpapiHostMsg_PPBVar_AddRefObject( | 246 proxy_object.dispatcher()->Send(new PpapiHostMsg_PPBVar_AddRefObject( |
| 248 API_ID_PPB_VAR_DEPRECATED, proxy_object.host_var_id(), &unused)); | 247 API_ID_PPB_VAR_DEPRECATED, proxy_object.host_var_id(), &unused)); |
| 249 } | 248 } |
| (...skipping 22 matching lines...) Expand all Loading... |
| 272 VarMap::iterator ret = live_vars_.find(found->second); | 271 VarMap::iterator ret = live_vars_.find(found->second); |
| 273 DCHECK(ret != live_vars_.end()); | 272 DCHECK(ret != live_vars_.end()); |
| 274 | 273 |
| 275 // All objects should be proxy objects. | 274 // All objects should be proxy objects. |
| 276 DCHECK(ret->second.var->AsProxyObjectVar()); | 275 DCHECK(ret->second.var->AsProxyObjectVar()); |
| 277 return scoped_refptr<ProxyObjectVar>(ret->second.var->AsProxyObjectVar()); | 276 return scoped_refptr<ProxyObjectVar>(ret->second.var->AsProxyObjectVar()); |
| 278 } | 277 } |
| 279 | 278 |
| 280 } // namesace proxy | 279 } // namesace proxy |
| 281 } // namespace ppapi | 280 } // namespace ppapi |
| OLD | NEW |