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 "webkit/plugins/ppapi/npobject_var.h" | 5 #include "webkit/plugins/ppapi/npobject_var.h" |
6 | 6 |
7 #include "base/logging.h" | 7 #include "base/logging.h" |
8 #include "ppapi/c/pp_var.h" | 8 #include "ppapi/c/pp_var.h" |
9 #include "third_party/WebKit/Source/WebKit/chromium/public/WebBindings.h" | 9 #include "third_party/WebKit/Source/WebKit/chromium/public/WebBindings.h" |
10 #include "webkit/plugins/ppapi/resource_tracker.h" | 10 #include "webkit/plugins/ppapi/resource_tracker.h" |
(...skipping 28 matching lines...) Expand all Loading... |
39 int32 id = GetOrCreateVarID(); | 39 int32 id = GetOrCreateVarID(); |
40 if (!id) | 40 if (!id) |
41 return PP_MakeNull(); | 41 return PP_MakeNull(); |
42 | 42 |
43 PP_Var result; | 43 PP_Var result; |
44 result.type = PP_VARTYPE_OBJECT; | 44 result.type = PP_VARTYPE_OBJECT; |
45 result.value.as_id = id; | 45 result.value.as_id = id; |
46 return result; | 46 return result; |
47 } | 47 } |
48 | 48 |
| 49 PP_VarType NPObjectVar::GetType() const { |
| 50 return PP_VARTYPE_OBJECT; |
| 51 } |
| 52 |
49 void NPObjectVar::InstanceDeleted() { | 53 void NPObjectVar::InstanceDeleted() { |
50 DCHECK(pp_instance_); | 54 DCHECK(pp_instance_); |
51 pp_instance_ = 0; | 55 pp_instance_ = 0; |
52 } | 56 } |
53 | 57 |
54 // static | 58 // static |
55 scoped_refptr<NPObjectVar> NPObjectVar::FromPPVar(PP_Var var) { | 59 scoped_refptr<NPObjectVar> NPObjectVar::FromPPVar(PP_Var var) { |
56 if (var.type != PP_VARTYPE_OBJECT) | 60 if (var.type != PP_VARTYPE_OBJECT) |
57 return scoped_refptr<NPObjectVar>(NULL); | 61 return scoped_refptr<NPObjectVar>(NULL); |
58 scoped_refptr<Var> var_object(webkit::ppapi::ResourceTracker::Get()->GetVar( | 62 scoped_refptr<Var> var_object( |
59 static_cast<int32>(var.value.as_id))); | 63 webkit::ppapi::ResourceTracker::Get()->GetVarTracker()->GetVar(var)); |
60 if (!var_object) | 64 if (!var_object) |
61 return scoped_refptr<NPObjectVar>(); | 65 return scoped_refptr<NPObjectVar>(); |
62 return scoped_refptr<NPObjectVar>(var_object->AsNPObjectVar()); | 66 return scoped_refptr<NPObjectVar>(var_object->AsNPObjectVar()); |
63 } | 67 } |
64 | 68 |
65 } // namespace ppapi | 69 } // namespace ppapi |
OLD | NEW |