1 // Copyright 2013 The Chromium Authors. All rights reserved. 2 // Use of this source code is governed by a BSD-style license that can be 3 // found in the LICENSE file. 4 5 #include "ppapi/shared_impl/resource_var.h" 6 7 #include "ppapi/shared_impl/ppapi_globals.h" 8 #include "ppapi/shared_impl/var_tracker.h" 9 10 namespace ppapi { 11 12 int ResourceVar::GetPendingRendererHostId() const { 13 return 0; 14 } 15 16 int ResourceVar::GetPendingBrowserHostId() const { 17 return 0; 18 } 19 20 const IPC::Message* ResourceVar::GetCreationMessage() const { 21 return NULL; 22 } 23 24 ResourceVar* ResourceVar::AsResourceVar() { 25 return this; 26 } 27 28 PP_VarType ResourceVar::GetType() const { 29 return PP_VARTYPE_RESOURCE; 30 } 31 32 // static 33 ResourceVar* ResourceVar::FromPPVar(PP_Var var) { 34 if (var.type != PP_VARTYPE_RESOURCE) 35 return NULL; 36 scoped_refptr<Var> var_object( 37 PpapiGlobals::Get()->GetVarTracker()->GetVar(var)); 38 if (!var_object.get()) 39 return NULL; 40 return var_object->AsResourceVar(); 41 } 42 43 ResourceVar::ResourceVar() {} 44 45 ResourceVar::~ResourceVar() {} 46 47 } // namespace ppapi 48