Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(141)

Side by Side Diff: ppapi/shared_impl/var.cc

Issue 23809016: [PPAPI] ResourceVar now reference counts its PP_Resource in the plugin. (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: Fix Windows compile. Created 7 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « ppapi/shared_impl/unittest_utils.cc ('k') | ppapi/shared_impl/var_tracker.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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/strings/string_number_conversions.h" 10 #include "base/strings/string_number_conversions.h"
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after
64 return "[Dictionary]"; 64 return "[Dictionary]";
65 case PP_VARTYPE_ARRAY_BUFFER: 65 case PP_VARTYPE_ARRAY_BUFFER:
66 return "[Array buffer]"; 66 return "[Array buffer]";
67 case PP_VARTYPE_RESOURCE: { 67 case PP_VARTYPE_RESOURCE: {
68 ResourceVar* resource(ResourceVar::FromPPVar(var)); 68 ResourceVar* resource(ResourceVar::FromPPVar(var));
69 if (!resource) 69 if (!resource)
70 return "[Invalid resource]"; 70 return "[Invalid resource]";
71 71
72 if (resource->IsPending()) { 72 if (resource->IsPending()) {
73 return base::StringPrintf("[Pending resource]"); 73 return base::StringPrintf("[Pending resource]");
74 } else if (resource->pp_resource()) { 74 } else if (resource->GetPPResource()) {
75 return base::StringPrintf("[Resource %d]", resource->pp_resource()); 75 return base::StringPrintf("[Resource %d]", resource->GetPPResource());
76 } else { 76 } else {
77 return "[Null resource]"; 77 return "[Null resource]";
78 } 78 }
79 } 79 }
80 default: 80 default:
81 return "[Invalid var]"; 81 return "[Invalid var]";
82 } 82 }
83 } 83 }
84 84
85 StringVar* Var::AsStringVar() { 85 StringVar* Var::AsStringVar() {
(...skipping 135 matching lines...) Expand 10 before | Expand all | Expand 10 after
221 return NULL; 221 return NULL;
222 scoped_refptr<Var> var_object( 222 scoped_refptr<Var> var_object(
223 PpapiGlobals::Get()->GetVarTracker()->GetVar(var)); 223 PpapiGlobals::Get()->GetVarTracker()->GetVar(var));
224 if (!var_object.get()) 224 if (!var_object.get())
225 return NULL; 225 return NULL;
226 return var_object->AsArrayBufferVar(); 226 return var_object->AsArrayBufferVar();
227 } 227 }
228 228
229 } // namespace ppapi 229 } // namespace ppapi
230 230
OLDNEW
« no previous file with comments | « ppapi/shared_impl/unittest_utils.cc ('k') | ppapi/shared_impl/var_tracker.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698