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

Side by Side Diff: ppapi/proxy/ppb_var_deprecated_proxy.cc

Issue 7621054: Don't use a scoped_refptr for StringVar::FromPPVar (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 9 years, 4 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 | Annotate | Revision Log
« no previous file with comments | « ppapi/proxy/ppb_url_util_proxy.cc ('k') | ppapi/proxy/ppb_var_proxy.cc » ('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) 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/proxy/ppb_var_deprecated_proxy.h" 5 #include "ppapi/proxy/ppb_var_deprecated_proxy.h"
6 6
7 #include <stdlib.h> // For malloc 7 #include <stdlib.h> // For malloc
8 8
9 #include "base/logging.h" 9 #include "base/logging.h"
10 #include "base/message_loop.h" 10 #include "base/message_loop.h"
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after
63 63
64 void ReleaseVar(PP_Var var) { 64 void ReleaseVar(PP_Var var) {
65 PluginResourceTracker::GetInstance()->var_tracker().ReleaseVar(var); 65 PluginResourceTracker::GetInstance()->var_tracker().ReleaseVar(var);
66 } 66 }
67 67
68 PP_Var VarFromUtf8(PP_Module module, const char* data, uint32_t len) { 68 PP_Var VarFromUtf8(PP_Module module, const char* data, uint32_t len) {
69 return StringVar::StringToPPVar(module, data, len); 69 return StringVar::StringToPPVar(module, data, len);
70 } 70 }
71 71
72 const char* VarToUtf8(PP_Var var, uint32_t* len) { 72 const char* VarToUtf8(PP_Var var, uint32_t* len) {
73 scoped_refptr<StringVar> str(StringVar::FromPPVar(var)); 73 StringVar* str = StringVar::FromPPVar(var);
74 if (str) { 74 if (str) {
75 *len = static_cast<uint32_t>(str->value().size()); 75 *len = static_cast<uint32_t>(str->value().size());
76 return str->value().c_str(); 76 return str->value().c_str();
77 } 77 }
78 *len = 0; 78 *len = 0;
79 return NULL; 79 return NULL;
80 } 80 }
81 81
82 bool HasProperty(PP_Var var, 82 bool HasProperty(PP_Var var,
83 PP_Var name, 83 PP_Var name,
(...skipping 430 matching lines...) Expand 10 before | Expand all | Expand 10 after
514 514
515 void PPB_Var_Deprecated_Proxy::DoReleaseObject(int64 object_id) { 515 void PPB_Var_Deprecated_Proxy::DoReleaseObject(int64 object_id) {
516 PP_Var var; 516 PP_Var var;
517 var.type = PP_VARTYPE_OBJECT; 517 var.type = PP_VARTYPE_OBJECT;
518 var.value.as_id = object_id; 518 var.value.as_id = object_id;
519 ppb_var_target()->Release(var); 519 ppb_var_target()->Release(var);
520 } 520 }
521 521
522 } // namespace proxy 522 } // namespace proxy
523 } // namespace ppapi 523 } // namespace ppapi
OLDNEW
« no previous file with comments | « ppapi/proxy/ppb_url_util_proxy.cc ('k') | ppapi/proxy/ppb_var_proxy.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698