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

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

Issue 8930010: Implement in-process PPB_VarArrayBuffer_Dev. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: merge Created 9 years 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/plugin_var_tracker.h ('k') | ppapi/proxy/proxy_object_var.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) 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/plugin_var_tracker.h" 5 #include "ppapi/proxy/plugin_var_tracker.h"
6 6
7 #include "base/memory/ref_counted.h" 7 #include "base/memory/ref_counted.h"
8 #include "base/memory/singleton.h" 8 #include "base/memory/singleton.h"
9 #include "ppapi/c/ppb_var.h" 9 #include "ppapi/c/ppb_var.h"
10 #include "ppapi/proxy/plugin_array_buffer_var.h"
10 #include "ppapi/proxy/plugin_dispatcher.h" 11 #include "ppapi/proxy/plugin_dispatcher.h"
11 #include "ppapi/proxy/ppapi_messages.h" 12 #include "ppapi/proxy/ppapi_messages.h"
12 #include "ppapi/proxy/proxy_object_var.h" 13 #include "ppapi/proxy/proxy_object_var.h"
13 #include "ppapi/shared_impl/api_id.h" 14 #include "ppapi/shared_impl/api_id.h"
14 #include "ppapi/shared_impl/var.h" 15 #include "ppapi/shared_impl/var.h"
15 16
16 namespace ppapi { 17 namespace ppapi {
17 namespace proxy { 18 namespace proxy {
18 19
19 PluginVarTracker::HostVar::HostVar(PluginDispatcher* d, int32 i) 20 PluginVarTracker::HostVar::HostVar(PluginDispatcher* d, int32 i)
(...skipping 129 matching lines...) Expand 10 before | Expand all | Expand 10 after
149 } 150 }
150 151
151 int PluginVarTracker::GetTrackedWithNoReferenceCountForObject( 152 int PluginVarTracker::GetTrackedWithNoReferenceCountForObject(
152 const PP_Var& plugin_object) { 153 const PP_Var& plugin_object) {
153 VarMap::iterator found = GetLiveVar(plugin_object); 154 VarMap::iterator found = GetLiveVar(plugin_object);
154 if (found == live_vars_.end()) 155 if (found == live_vars_.end())
155 return -1; 156 return -1;
156 return found->second.track_with_no_reference_count; 157 return found->second.track_with_no_reference_count;
157 } 158 }
158 159
160 ArrayBufferVar* PluginVarTracker::CreateArrayBuffer(uint32 size_in_bytes) {
161 return new PluginArrayBufferVar(size_in_bytes);
162 }
163
159 int32 PluginVarTracker::AddVarInternal(Var* var, AddVarRefMode mode) { 164 int32 PluginVarTracker::AddVarInternal(Var* var, AddVarRefMode mode) {
160 // Normal adding. 165 // Normal adding.
161 int32 new_id = VarTracker::AddVarInternal(var, mode); 166 int32 new_id = VarTracker::AddVarInternal(var, mode);
162 167
163 // Need to add proxy objects to the host var map. 168 // Need to add proxy objects to the host var map.
164 ProxyObjectVar* proxy_object = var->AsProxyObjectVar(); 169 ProxyObjectVar* proxy_object = var->AsProxyObjectVar();
165 if (proxy_object) { 170 if (proxy_object) {
166 HostVar host_var(proxy_object->dispatcher(), proxy_object->host_var_id()); 171 HostVar host_var(proxy_object->dispatcher(), proxy_object->host_var_id());
167 DCHECK(host_var_to_plugin_var_.find(host_var) == 172 DCHECK(host_var_to_plugin_var_.find(host_var) ==
168 host_var_to_plugin_var_.end()); // Adding an object twice, use 173 host_var_to_plugin_var_.end()); // Adding an object twice, use
(...skipping 98 matching lines...) Expand 10 before | Expand all | Expand 10 after
267 VarMap::iterator ret = live_vars_.find(found->second); 272 VarMap::iterator ret = live_vars_.find(found->second);
268 DCHECK(ret != live_vars_.end()); 273 DCHECK(ret != live_vars_.end());
269 274
270 // All objects should be proxy objects. 275 // All objects should be proxy objects.
271 DCHECK(ret->second.var->AsProxyObjectVar()); 276 DCHECK(ret->second.var->AsProxyObjectVar());
272 return scoped_refptr<ProxyObjectVar>(ret->second.var->AsProxyObjectVar()); 277 return scoped_refptr<ProxyObjectVar>(ret->second.var->AsProxyObjectVar());
273 } 278 }
274 279
275 } // namesace proxy 280 } // namesace proxy
276 } // namespace ppapi 281 } // namespace ppapi
OLDNEW
« no previous file with comments | « ppapi/proxy/plugin_var_tracker.h ('k') | ppapi/proxy/proxy_object_var.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698