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

Side by Side Diff: content/renderer/pepper/host_var_tracker.cc

Issue 26564009: [PPAPI] It is now possible to pass filesystems from JavaScript to NaCl modules. (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: Address comments. Created 7 years, 1 month 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
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 "content/renderer/pepper/host_var_tracker.h" 5 #include "content/renderer/pepper/host_var_tracker.h"
6 6
7 #include "base/logging.h" 7 #include "base/logging.h"
8 #include "content/renderer/pepper/host_array_buffer_var.h" 8 #include "content/renderer/pepper/host_array_buffer_var.h"
9 #include "content/renderer/pepper/host_resource_var.h" 9 #include "content/renderer/pepper/host_resource_var.h"
10 #include "content/renderer/pepper/npobject_var.h" 10 #include "content/renderer/pepper/npobject_var.h"
(...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after
96 96
97 int HostVarTracker::GetLiveNPObjectVarsForInstance(PP_Instance instance) const { 97 int HostVarTracker::GetLiveNPObjectVarsForInstance(PP_Instance instance) const {
98 CheckThreadingPreconditions(); 98 CheckThreadingPreconditions();
99 99
100 InstanceMap::const_iterator found = instance_map_.find(instance); 100 InstanceMap::const_iterator found = instance_map_.find(instance);
101 if (found == instance_map_.end()) 101 if (found == instance_map_.end())
102 return 0; 102 return 0;
103 return static_cast<int>(found->second->size()); 103 return static_cast<int>(found->second->size());
104 } 104 }
105 105
106 PP_Var HostVarTracker::MakeResourcePPVarFromMessage(
107 PP_Instance instance,
108 const IPC::Message& creation_message,
109 int pending_renderer_id,
110 int pending_browser_id) {
111 // On the host side, the creation message is ignored when creating a resource.
112 // Therefore, a call to this function indicates a null resource. Return the
113 // resource 0.
114 return MakeResourcePPVar(0);
115 }
116
106 ppapi::ResourceVar* HostVarTracker::MakeResourceVar(PP_Resource pp_resource) { 117 ppapi::ResourceVar* HostVarTracker::MakeResourceVar(PP_Resource pp_resource) {
107 return new HostResourceVar(pp_resource); 118 return new HostResourceVar(pp_resource);
108 } 119 }
109 120
110 void HostVarTracker::DidDeleteInstance(PP_Instance instance) { 121 void HostVarTracker::DidDeleteInstance(PP_Instance instance) {
111 CheckThreadingPreconditions(); 122 CheckThreadingPreconditions();
112 123
113 InstanceMap::iterator found_instance = instance_map_.find(instance); 124 InstanceMap::iterator found_instance = instance_map_.find(instance);
114 if (found_instance == instance_map_.end()) 125 if (found_instance == instance_map_.end())
115 return; // Nothing to do. 126 return; // Nothing to do.
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after
167 if (it->second.instance != instance) 178 if (it->second.instance != instance)
168 return false; 179 return false;
169 180
170 *handle = it->second.handle; 181 *handle = it->second.handle;
171 *size_in_bytes = it->second.size_in_bytes; 182 *size_in_bytes = it->second.size_in_bytes;
172 shared_memory_map_.erase(it); 183 shared_memory_map_.erase(it);
173 return true; 184 return true;
174 } 185 }
175 186
176 } // namespace content 187 } // namespace content
OLDNEW
« no previous file with comments | « content/renderer/pepper/host_var_tracker.h ('k') | content/renderer/pepper/resource_converter.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698