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

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

Issue 6334016: Refactor PPAPI proxy resource handling to maintain which host they came from,... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 9 years, 10 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/host_var_serialization_rules.h ('k') | ppapi/proxy/image_data.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) 2010 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2010 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/host_var_serialization_rules.h" 5 #include "ppapi/proxy/host_var_serialization_rules.h"
6 6
7 #include "base/logging.h" 7 #include "base/logging.h"
8 #include "ppapi/c/dev/ppb_var_deprecated.h" 8 #include "ppapi/c/dev/ppb_var_deprecated.h"
9 9
10 namespace pp { 10 namespace pp {
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after
55 static_cast<uint32_t>(str_val.size())); 55 static_cast<uint32_t>(str_val.size()));
56 } 56 }
57 57
58 // See PluginVarSerialization::BeginSendPassRef for an example. 58 // See PluginVarSerialization::BeginSendPassRef for an example.
59 if (var.type == PP_VARTYPE_OBJECT) 59 if (var.type == PP_VARTYPE_OBJECT)
60 var_interface_->AddRef(var); 60 var_interface_->AddRef(var);
61 return var; 61 return var;
62 } 62 }
63 63
64 PP_Var HostVarSerializationRules::BeginSendPassRef(const PP_Var& var, 64 PP_Var HostVarSerializationRules::BeginSendPassRef(const PP_Var& var,
65 std::string* str_val) { 65 std::string* str_val) {
66 // See PluginVarSerialization::ReceivePassRef for an example. We don't need 66 // See PluginVarSerialization::ReceivePassRef for an example. We don't need
67 // to do anything here other than convert the string. 67 // to do anything here other than convert the string.
68 if (var.type == PP_VARTYPE_STRING) 68 if (var.type == PP_VARTYPE_STRING)
69 VarToString(var, str_val); 69 VarToString(var, str_val);
70 return var; 70 return var;
71 } 71 }
72 72
73 void HostVarSerializationRules::EndSendPassRef(const PP_Var& var) { 73 void HostVarSerializationRules::EndSendPassRef(const PP_Var& /* var */,
74 Dispatcher* /* dispatcher */) {
74 // See PluginVarSerialization::ReceivePassRef for an example. We don't need 75 // See PluginVarSerialization::ReceivePassRef for an example. We don't need
75 // to do anything here. 76 // to do anything here.
76 } 77 }
77 78
78 void HostVarSerializationRules::VarToString(const PP_Var& var, 79 void HostVarSerializationRules::VarToString(const PP_Var& var,
79 std::string* str) { 80 std::string* str) {
80 DCHECK(var.type == PP_VARTYPE_STRING); 81 DCHECK(var.type == PP_VARTYPE_STRING);
81 82
82 // This could be optimized to avoid an extra string copy by going to a lower 83 // This could be optimized to avoid an extra string copy by going to a lower
83 // level of the browser's implementation of strings where we already have 84 // level of the browser's implementation of strings where we already have
84 // a std::string. 85 // a std::string.
85 uint32_t len = 0; 86 uint32_t len = 0;
86 const char* data = var_interface_->VarToUtf8(var, &len); 87 const char* data = var_interface_->VarToUtf8(var, &len);
87 str->assign(data, len); 88 str->assign(data, len);
88 } 89 }
89 90
90 void HostVarSerializationRules::ReleaseObjectRef(const PP_Var& var) { 91 void HostVarSerializationRules::ReleaseObjectRef(const PP_Var& var) {
91 var_interface_->Release(var); 92 var_interface_->Release(var);
92 } 93 }
93 94
94 } // namespace proxy 95 } // namespace proxy
95 } // namespace pp 96 } // namespace pp
OLDNEW
« no previous file with comments | « ppapi/proxy/host_var_serialization_rules.h ('k') | ppapi/proxy/image_data.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698