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