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

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

Issue 874703003: PPAPI: Release renderer Var refcount when returning to plugin (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: review comments Created 5 years, 11 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 | « no previous file | ppapi/proxy/serialized_var_unittest.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/host_var_serialization_rules.h" 5 #include "ppapi/proxy/host_var_serialization_rules.h"
6 6
7 #include "ppapi/shared_impl/ppapi_globals.h" 7 #include "ppapi/shared_impl/ppapi_globals.h"
8 #include "ppapi/shared_impl/var_tracker.h" 8 #include "ppapi/shared_impl/var_tracker.h"
9 9
10 using ppapi::PpapiGlobals; 10 using ppapi::PpapiGlobals;
(...skipping 27 matching lines...) Expand all
38 // See PluginVarSerialization::BeginSendPassRef for an example. 38 // See PluginVarSerialization::BeginSendPassRef for an example.
39 if (var.type == PP_VARTYPE_OBJECT) 39 if (var.type == PP_VARTYPE_OBJECT)
40 PpapiGlobals::Get()->GetVarTracker()->AddRefVar(var); 40 PpapiGlobals::Get()->GetVarTracker()->AddRefVar(var);
41 return var; 41 return var;
42 } 42 }
43 43
44 PP_Var HostVarSerializationRules::BeginSendPassRef(const PP_Var& var) { 44 PP_Var HostVarSerializationRules::BeginSendPassRef(const PP_Var& var) {
45 return var; 45 return var;
46 } 46 }
47 47
48 void HostVarSerializationRules::EndSendPassRef(const PP_Var& /* var */) { 48 void HostVarSerializationRules::EndSendPassRef(const PP_Var& var) {
49 // See PluginVarSerialization::ReceivePassRef for an example. We don't need 49 // See PluginVarSerializationRules::ReceivePassRef for an example. We don't
50 // to do anything here. 50 // need to do anything here for "Object" vars; we continue holding one ref on
51 // behalf of the plugin.
52 if (var.type != PP_VARTYPE_OBJECT) {
53 // But for other ref-counted types (like String, Array, and Dictionary),
54 // the value will be re-constituted on the other side as a new Var with no
55 // connection to the host-side reference counting. We must therefore release
56 // our reference count; this is roughly equivalent to passing the ref to the
57 // plugin.
58 PpapiGlobals::Get()->GetVarTracker()->ReleaseVar(var);
59 }
51 } 60 }
52 61
53 void HostVarSerializationRules::ReleaseObjectRef(const PP_Var& var) { 62 void HostVarSerializationRules::ReleaseObjectRef(const PP_Var& var) {
54 PpapiGlobals::Get()->GetVarTracker()->ReleaseVar(var); 63 PpapiGlobals::Get()->GetVarTracker()->ReleaseVar(var);
55 } 64 }
56 65
57 } // namespace proxy 66 } // namespace proxy
58 } // namespace ppapi 67 } // namespace ppapi
OLDNEW
« no previous file with comments | « no previous file | ppapi/proxy/serialized_var_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698