| 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/shared_impl/var.h" | 5 #include "ppapi/shared_impl/var.h" |
| 6 | 6 |
| 7 #include <limits> | 7 #include <limits> |
| 8 | 8 |
| 9 #include "base/logging.h" | 9 #include "base/logging.h" |
| 10 #include "base/string_number_conversions.h" | 10 #include "base/string_number_conversions.h" |
| 11 #include "base/string_util.h" | 11 #include "base/string_util.h" |
| 12 #include "ppapi/c/pp_var.h" | 12 #include "ppapi/c/pp_var.h" |
| 13 #include "ppapi/shared_impl/ppapi_globals.h" | 13 #include "ppapi/shared_impl/tracker_base.h" |
| 14 #include "ppapi/shared_impl/var_tracker.h" | 14 #include "ppapi/shared_impl/var_tracker.h" |
| 15 | 15 |
| 16 namespace ppapi { | 16 namespace ppapi { |
| 17 | 17 |
| 18 // Var ------------------------------------------------------------------------- | 18 // Var ------------------------------------------------------------------------- |
| 19 | 19 |
| 20 Var::Var(PP_Module module) : pp_module_(module), var_id_(0) { | 20 Var::Var(PP_Module module) : pp_module_(module), var_id_(0) { |
| 21 } | 21 } |
| 22 | 22 |
| 23 Var::~Var() { | 23 Var::~Var() { |
| (...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 71 | 71 |
| 72 ProxyObjectVar* Var::AsProxyObjectVar() { | 72 ProxyObjectVar* Var::AsProxyObjectVar() { |
| 73 return NULL; | 73 return NULL; |
| 74 } | 74 } |
| 75 | 75 |
| 76 int32 Var::GetExistingVarID() const { | 76 int32 Var::GetExistingVarID() const { |
| 77 return var_id_; | 77 return var_id_; |
| 78 } | 78 } |
| 79 | 79 |
| 80 int32 Var::GetOrCreateVarID() { | 80 int32 Var::GetOrCreateVarID() { |
| 81 VarTracker* tracker = PpapiGlobals::Get()->GetVarTracker(); | 81 VarTracker* tracker = TrackerBase::Get()->GetVarTracker(); |
| 82 if (var_id_) { | 82 if (var_id_) { |
| 83 if (!tracker->AddRefVar(var_id_)) | 83 if (!tracker->AddRefVar(var_id_)) |
| 84 return 0; | 84 return 0; |
| 85 } else { | 85 } else { |
| 86 var_id_ = tracker->AddVar(this); | 86 var_id_ = tracker->AddVar(this); |
| 87 if (!var_id_) | 87 if (!var_id_) |
| 88 return 0; | 88 return 0; |
| 89 } | 89 } |
| 90 return var_id_; | 90 return var_id_; |
| 91 } | 91 } |
| (...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 141 if (!str || !IsStringUTF8(str->value())) | 141 if (!str || !IsStringUTF8(str->value())) |
| 142 return PP_MakeNull(); | 142 return PP_MakeNull(); |
| 143 return str->GetPPVar(); | 143 return str->GetPPVar(); |
| 144 } | 144 } |
| 145 | 145 |
| 146 // static | 146 // static |
| 147 StringVar* StringVar::FromPPVar(PP_Var var) { | 147 StringVar* StringVar::FromPPVar(PP_Var var) { |
| 148 if (var.type != PP_VARTYPE_STRING) | 148 if (var.type != PP_VARTYPE_STRING) |
| 149 return NULL; | 149 return NULL; |
| 150 scoped_refptr<Var> var_object( | 150 scoped_refptr<Var> var_object( |
| 151 PpapiGlobals::Get()->GetVarTracker()->GetVar(var)); | 151 TrackerBase::Get()->GetVarTracker()->GetVar(var)); |
| 152 if (!var_object) | 152 if (!var_object) |
| 153 return NULL; | 153 return NULL; |
| 154 return var_object->AsStringVar(); | 154 return var_object->AsStringVar(); |
| 155 } | 155 } |
| 156 | 156 |
| 157 } // namespace ppapi | 157 } // namespace ppapi |
| 158 | 158 |
| OLD | NEW |