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

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

Issue 9373032: PPAPI: Proxy VarArrayBuffer for out-of-process. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: merge... again Created 8 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/interface_list.cc ('k') | ppapi/proxy/ppb_instance_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) 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/proxy/plugin_var_serialization_rules.h" 5 #include "ppapi/proxy/plugin_var_serialization_rules.h"
6 6
7 #include "base/logging.h" 7 #include "base/logging.h"
8 #include "ppapi/proxy/plugin_dispatcher.h" 8 #include "ppapi/proxy/plugin_dispatcher.h"
9 #include "ppapi/proxy/plugin_globals.h" 9 #include "ppapi/proxy/plugin_globals.h"
10 #include "ppapi/proxy/plugin_resource_tracker.h" 10 #include "ppapi/proxy/plugin_resource_tracker.h"
(...skipping 23 matching lines...) Expand all
34 Dispatcher* dispatcher) { 34 Dispatcher* dispatcher) {
35 if (var.type == PP_VARTYPE_OBJECT) { 35 if (var.type == PP_VARTYPE_OBJECT) {
36 DCHECK(dispatcher->IsPlugin()); 36 DCHECK(dispatcher->IsPlugin());
37 return var_tracker_->TrackObjectWithNoReference( 37 return var_tracker_->TrackObjectWithNoReference(
38 var, static_cast<PluginDispatcher*>(dispatcher)); 38 var, static_cast<PluginDispatcher*>(dispatcher));
39 } 39 }
40 return var; 40 return var;
41 } 41 }
42 42
43 void PluginVarSerializationRules::EndReceiveCallerOwned(const PP_Var& var) { 43 void PluginVarSerializationRules::EndReceiveCallerOwned(const PP_Var& var) {
44 if (var.type == PP_VARTYPE_STRING) { 44 if (var.type == PP_VARTYPE_OBJECT) {
45 // Destroy the string. 45 var_tracker_->StopTrackingObjectWithNoReference(var);
46 } else if (var.type >= PP_VARTYPE_STRING) {
47 // Release our reference to the local Var.
46 var_tracker_->ReleaseVar(var); 48 var_tracker_->ReleaseVar(var);
47 } else if (var.type == PP_VARTYPE_OBJECT) {
48 var_tracker_->StopTrackingObjectWithNoReference(var);
49 } 49 }
50 } 50 }
51 51
52 PP_Var PluginVarSerializationRules::ReceivePassRef(const PP_Var& var, 52 PP_Var PluginVarSerializationRules::ReceivePassRef(const PP_Var& var,
53 Dispatcher* dispatcher) { 53 Dispatcher* dispatcher) {
54 // Overview of sending an object with "pass ref" from the browser to the 54 // Overview of sending an object with "pass ref" from the browser to the
55 // plugin: 55 // plugin:
56 // Example 1 Example 2 56 // Example 1 Example 2
57 // Plugin Browser Plugin Browser 57 // Plugin Browser Plugin Browser
58 // Before send 3 2 0 1 58 // Before send 3 2 0 1
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after
101 101
102 void PluginVarSerializationRules::EndSendPassRef(const PP_Var& var, 102 void PluginVarSerializationRules::EndSendPassRef(const PP_Var& var,
103 Dispatcher* dispatcher) { 103 Dispatcher* dispatcher) {
104 // See BeginSendPassRef for an example of why we release our ref here. 104 // See BeginSendPassRef for an example of why we release our ref here.
105 // The var we have in our inner class has been converted to a host object 105 // The var we have in our inner class has been converted to a host object
106 // by BeginSendPassRef. This means it's not a normal var valid in the plugin, 106 // by BeginSendPassRef. This means it's not a normal var valid in the plugin,
107 // so we need to use the special ReleaseHostObject. 107 // so we need to use the special ReleaseHostObject.
108 if (var.type == PP_VARTYPE_OBJECT) { 108 if (var.type == PP_VARTYPE_OBJECT) {
109 var_tracker_->ReleaseHostObject( 109 var_tracker_->ReleaseHostObject(
110 static_cast<PluginDispatcher*>(dispatcher), var); 110 static_cast<PluginDispatcher*>(dispatcher), var);
111 } else if (var.type == PP_VARTYPE_STRING) { 111 } else if (var.type >= PP_VARTYPE_STRING) {
112 var_tracker_->ReleaseVar(var); 112 var_tracker_->ReleaseVar(var);
113 } 113 }
114 } 114 }
115 115
116 void PluginVarSerializationRules::ReleaseObjectRef(const PP_Var& var) { 116 void PluginVarSerializationRules::ReleaseObjectRef(const PP_Var& var) {
117 var_tracker_->ReleaseVar(var); 117 var_tracker_->ReleaseVar(var);
118 } 118 }
119 119
120 } // namespace proxy 120 } // namespace proxy
121 } // namespace ppapi 121 } // namespace ppapi
OLDNEW
« no previous file with comments | « ppapi/proxy/interface_list.cc ('k') | ppapi/proxy/ppb_instance_proxy.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698