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

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

Issue 7578001: Unify var tracking between webkit and the proxy. (Closed) Base URL: svn://chrome-svn/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_var_deprecated_proxy.cc ('k') | ppapi/proxy/ppp_messaging_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_proxy.h" 5 #include "ppapi/proxy/ppb_var_proxy.h"
6 6
7 #include "ppapi/c/pp_var.h" 7 #include "ppapi/c/pp_var.h"
8 #include "ppapi/c/ppb_var.h" 8 #include "ppapi/c/ppb_var.h"
9 #include "ppapi/proxy/plugin_resource_tracker.h"
9 #include "ppapi/proxy/plugin_var_tracker.h" 10 #include "ppapi/proxy/plugin_var_tracker.h"
11 #include "ppapi/shared_impl/var.h"
12
13 using ppapi::StringVar;
10 14
11 namespace pp { 15 namespace pp {
12 namespace proxy { 16 namespace proxy {
13 17
14 namespace { 18 namespace {
15 19
16 // PPP_Var plugin -------------------------------------------------------------- 20 // PPP_Var plugin --------------------------------------------------------------
17 21
18 void AddRefVar(PP_Var var) { 22 void AddRefVar(PP_Var var) {
19 PluginVarTracker::GetInstance()->AddRef(var); 23 PluginResourceTracker::GetInstance()->var_tracker().AddRefVar(var);
20 } 24 }
21 25
22 void ReleaseVar(PP_Var var) { 26 void ReleaseVar(PP_Var var) {
23 PluginVarTracker::GetInstance()->Release(var); 27 PluginResourceTracker::GetInstance()->var_tracker().ReleaseVar(var);
24 } 28 }
25 29
26 PP_Var VarFromUtf8(PP_Module module, const char* data, uint32_t len) { 30 PP_Var VarFromUtf8(PP_Module module, const char* data, uint32_t len) {
27 PP_Var ret = {}; 31 return StringVar::StringToPPVar(module, data, len);
28 ret.type = PP_VARTYPE_STRING;
29 ret.value.as_id = PluginVarTracker::GetInstance()->MakeString(data, len);
30 return ret;
31 } 32 }
32 33
33 const char* VarToUtf8(PP_Var var, uint32_t* len) { 34 const char* VarToUtf8(PP_Var var, uint32_t* len) {
34 const std::string* str = 35 scoped_refptr<StringVar> str(StringVar::FromPPVar(var));
35 PluginVarTracker::GetInstance()->GetExistingString(var);
36 if (str) { 36 if (str) {
37 *len = static_cast<uint32_t>(str->size()); 37 *len = static_cast<uint32_t>(str->value().size());
38 return str->c_str(); 38 return str->value().c_str();
39 } 39 }
40 *len = 0; 40 *len = 0;
41 return NULL; 41 return NULL;
42 } 42 }
43 43
44 const PPB_Var var_interface = { 44 const PPB_Var var_interface = {
45 &AddRefVar, 45 &AddRefVar,
46 &ReleaseVar, 46 &ReleaseVar,
47 &VarFromUtf8, 47 &VarFromUtf8,
48 &VarToUtf8 48 &VarToUtf8
(...skipping 27 matching lines...) Expand all
76 } 76 }
77 77
78 bool PPB_Var_Proxy::OnMessageReceived(const IPC::Message& msg) { 78 bool PPB_Var_Proxy::OnMessageReceived(const IPC::Message& msg) {
79 // All PPB_Var calls are handled locally; there is no need to send or receive 79 // All PPB_Var calls are handled locally; there is no need to send or receive
80 // messages here. 80 // messages here.
81 return false; 81 return false;
82 } 82 }
83 83
84 } // namespace proxy 84 } // namespace proxy
85 } // namespace pp 85 } // namespace pp
OLDNEW
« no previous file with comments | « ppapi/proxy/ppb_var_deprecated_proxy.cc ('k') | ppapi/proxy/ppp_messaging_proxy.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698