OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 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 | 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/shared_impl/resource_var.h" | 5 #include "ppapi/shared_impl/resource_var.h" |
6 | 6 |
7 #include "ppapi/shared_impl/ppapi_globals.h" | 7 #include "ppapi/shared_impl/ppapi_globals.h" |
8 #include "ppapi/shared_impl/var_tracker.h" | 8 #include "ppapi/shared_impl/var_tracker.h" |
9 | 9 |
10 namespace ppapi { | 10 namespace ppapi { |
11 | 11 |
12 int ResourceVar::GetPendingRendererHostId() const { | 12 int ResourceVar::GetPendingRendererHostId() const { return 0; } |
13 return 0; | |
14 } | |
15 | 13 |
16 int ResourceVar::GetPendingBrowserHostId() const { | 14 int ResourceVar::GetPendingBrowserHostId() const { return 0; } |
17 return 0; | |
18 } | |
19 | 15 |
20 const IPC::Message* ResourceVar::GetCreationMessage() const { | 16 const IPC::Message* ResourceVar::GetCreationMessage() const { return NULL; } |
21 return NULL; | |
22 } | |
23 | 17 |
24 ResourceVar* ResourceVar::AsResourceVar() { | 18 ResourceVar* ResourceVar::AsResourceVar() { return this; } |
25 return this; | |
26 } | |
27 | 19 |
28 PP_VarType ResourceVar::GetType() const { | 20 PP_VarType ResourceVar::GetType() const { return PP_VARTYPE_RESOURCE; } |
29 return PP_VARTYPE_RESOURCE; | |
30 } | |
31 | 21 |
32 // static | 22 // static |
33 ResourceVar* ResourceVar::FromPPVar(PP_Var var) { | 23 ResourceVar* ResourceVar::FromPPVar(PP_Var var) { |
34 if (var.type != PP_VARTYPE_RESOURCE) | 24 if (var.type != PP_VARTYPE_RESOURCE) |
35 return NULL; | 25 return NULL; |
36 scoped_refptr<Var> var_object( | 26 scoped_refptr<Var> var_object( |
37 PpapiGlobals::Get()->GetVarTracker()->GetVar(var)); | 27 PpapiGlobals::Get()->GetVarTracker()->GetVar(var)); |
38 if (!var_object.get()) | 28 if (!var_object.get()) |
39 return NULL; | 29 return NULL; |
40 return var_object->AsResourceVar(); | 30 return var_object->AsResourceVar(); |
41 } | 31 } |
42 | 32 |
43 ResourceVar::ResourceVar() {} | 33 ResourceVar::ResourceVar() {} |
44 | 34 |
45 ResourceVar::~ResourceVar() {} | 35 ResourceVar::~ResourceVar() {} |
46 | 36 |
47 } // namespace ppapi | 37 } // namespace ppapi |
OLD | NEW |