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

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

Issue 1113783002: Use Local instead of Handle in src/content/* (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 7 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
OLDNEW
1 // Copyright 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 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/resource_converter.h" 5 #include "content/renderer/pepper/resource_converter.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/message_loop/message_loop.h" 8 #include "base/message_loop/message_loop.h"
9 #include "content/public/renderer/renderer_ppapi_host.h" 9 #include "content/public/renderer/renderer_ppapi_host.h"
10 #include "content/renderer/pepper/pepper_file_system_host.h" 10 #include "content/renderer/pepper/pepper_file_system_host.h"
(...skipping 104 matching lines...) Expand 10 before | Expand all | Expand 10 after
115 new PpapiPluginMsg_FileSystem_CreateFromPendingHost(file_system_type)); 115 new PpapiPluginMsg_FileSystem_CreateFromPendingHost(file_system_type));
116 116
117 browser_host_create_message->reset( 117 browser_host_create_message->reset(
118 new PpapiHostMsg_FileSystem_CreateFromRenderer(root_url.spec(), 118 new PpapiHostMsg_FileSystem_CreateFromRenderer(root_url.spec(),
119 file_system_type)); 119 file_system_type));
120 return true; 120 return true;
121 } 121 }
122 122
123 bool ResourceHostToDOMFileSystem( 123 bool ResourceHostToDOMFileSystem(
124 content::PepperFileSystemHost* file_system_host, 124 content::PepperFileSystemHost* file_system_host,
125 v8::Handle<v8::Context> context, 125 v8::Local<v8::Context> context,
126 v8::Handle<v8::Value>* dom_file_system) { 126 v8::Local<v8::Value>* dom_file_system) {
127 GURL root_url = file_system_host->GetRootUrl(); 127 GURL root_url = file_system_host->GetRootUrl();
128 GURL origin; 128 GURL origin;
129 storage::FileSystemType type; 129 storage::FileSystemType type;
130 base::FilePath virtual_path; 130 base::FilePath virtual_path;
131 storage::ParseFileSystemSchemeURL(root_url, &origin, &type, &virtual_path); 131 storage::ParseFileSystemSchemeURL(root_url, &origin, &type, &virtual_path);
132 132
133 std::string name = storage::GetFileSystemName(origin, type); 133 std::string name = storage::GetFileSystemName(origin, type);
134 blink::WebFileSystemType blink_type; 134 blink::WebFileSystemType blink_type;
135 if (!FileApiFileSystemTypeToWebFileSystemType(type, &blink_type)) 135 if (!FileApiFileSystemTypeToWebFileSystemType(type, &blink_type))
136 return false; 136 return false;
137 blink::WebLocalFrame* frame = blink::WebLocalFrame::frameForContext(context); 137 blink::WebLocalFrame* frame = blink::WebLocalFrame::frameForContext(context);
138 blink::WebDOMFileSystem web_dom_file_system = blink::WebDOMFileSystem::create( 138 blink::WebDOMFileSystem web_dom_file_system = blink::WebDOMFileSystem::create(
139 frame, 139 frame,
140 blink_type, 140 blink_type,
141 blink::WebString::fromUTF8(name), 141 blink::WebString::fromUTF8(name),
142 root_url, 142 root_url,
143 blink::WebDOMFileSystem::SerializableTypeSerializable); 143 blink::WebDOMFileSystem::SerializableTypeSerializable);
144 *dom_file_system = 144 *dom_file_system =
145 web_dom_file_system.toV8Value(context->Global(), context->GetIsolate()); 145 web_dom_file_system.toV8Value(context->Global(), context->GetIsolate());
146 return true; 146 return true;
147 } 147 }
148 148
149 bool ResourceHostToDOMMediaStreamVideoTrack( 149 bool ResourceHostToDOMMediaStreamVideoTrack(
150 content::PepperMediaStreamVideoTrackHost* host, 150 content::PepperMediaStreamVideoTrackHost* host,
151 v8::Handle<v8::Context> context, 151 v8::Local<v8::Context> context,
152 v8::Handle<v8::Value>* dom_video_track) { 152 v8::Local<v8::Value>* dom_video_track) {
153 // TODO(ronghuawu): Implement this once crbug/352219 is resolved. 153 // TODO(ronghuawu): Implement this once crbug/352219 is resolved.
154 // blink::WebMediaStreamTrack track = host->track(); 154 // blink::WebMediaStreamTrack track = host->track();
155 // *dom_video_track = track.toV8Value(); 155 // *dom_video_track = track.toV8Value();
156 return false; 156 return false;
157 } 157 }
158 158
159 bool DOMMediaStreamTrackToResource( 159 bool DOMMediaStreamTrackToResource(
160 PP_Instance instance, 160 PP_Instance instance,
161 RendererPpapiHost* host, 161 RendererPpapiHost* host,
162 const blink::WebDOMMediaStreamTrack& dom_media_stream_track, 162 const blink::WebDOMMediaStreamTrack& dom_media_stream_track,
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after
199 199
200 ResourceConverterImpl::ResourceConverterImpl(PP_Instance instance) 200 ResourceConverterImpl::ResourceConverterImpl(PP_Instance instance)
201 : instance_(instance) {} 201 : instance_(instance) {}
202 202
203 ResourceConverterImpl::~ResourceConverterImpl() { 203 ResourceConverterImpl::~ResourceConverterImpl() {
204 // Verify Flush() was called. 204 // Verify Flush() was called.
205 DCHECK(browser_host_create_messages_.empty()); 205 DCHECK(browser_host_create_messages_.empty());
206 DCHECK(browser_vars_.empty()); 206 DCHECK(browser_vars_.empty());
207 } 207 }
208 208
209 bool ResourceConverterImpl::FromV8Value(v8::Handle<v8::Object> val, 209 bool ResourceConverterImpl::FromV8Value(v8::Local<v8::Object> val,
210 v8::Handle<v8::Context> context, 210 v8::Local<v8::Context> context,
211 PP_Var* result, 211 PP_Var* result,
212 bool* was_resource) { 212 bool* was_resource) {
213 v8::Context::Scope context_scope(context); 213 v8::Context::Scope context_scope(context);
214 v8::HandleScope handle_scope(context->GetIsolate()); 214 v8::HandleScope handle_scope(context->GetIsolate());
215 RendererPpapiHost* host = RendererPpapiHost::GetForPPInstance(instance_); 215 RendererPpapiHost* host = RendererPpapiHost::GetForPPInstance(instance_);
216 216
217 *was_resource = false; 217 *was_resource = false;
218 218
219 blink::WebDOMFileSystem dom_file_system = 219 blink::WebDOMFileSystem dom_file_system =
220 blink::WebDOMFileSystem::fromV8Value(val); 220 blink::WebDOMFileSystem::fromV8Value(val);
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after
278 void ResourceConverterImpl::Flush(const base::Callback<void(bool)>& callback) { 278 void ResourceConverterImpl::Flush(const base::Callback<void(bool)>& callback) {
279 RendererPpapiHost::GetForPPInstance(instance_)->CreateBrowserResourceHosts( 279 RendererPpapiHost::GetForPPInstance(instance_)->CreateBrowserResourceHosts(
280 instance_, 280 instance_,
281 browser_host_create_messages_, 281 browser_host_create_messages_,
282 base::Bind(&FlushComplete, callback, browser_vars_)); 282 base::Bind(&FlushComplete, callback, browser_vars_));
283 browser_host_create_messages_.clear(); 283 browser_host_create_messages_.clear();
284 browser_vars_.clear(); 284 browser_vars_.clear();
285 } 285 }
286 286
287 bool ResourceConverterImpl::ToV8Value(const PP_Var& var, 287 bool ResourceConverterImpl::ToV8Value(const PP_Var& var,
288 v8::Handle<v8::Context> context, 288 v8::Local<v8::Context> context,
289 v8::Handle<v8::Value>* result) { 289 v8::Local<v8::Value>* result) {
290 DCHECK(var.type == PP_VARTYPE_RESOURCE); 290 DCHECK(var.type == PP_VARTYPE_RESOURCE);
291 291
292 ResourceVar* resource = ResourceVar::FromPPVar(var); 292 ResourceVar* resource = ResourceVar::FromPPVar(var);
293 if (!resource) { 293 if (!resource) {
294 NOTREACHED(); 294 NOTREACHED();
295 return false; 295 return false;
296 } 296 }
297 PP_Resource resource_id = resource->GetPPResource(); 297 PP_Resource resource_id = resource->GetPPResource();
298 298
299 // Get the renderer-side resource host for this resource. 299 // Get the renderer-side resource host for this resource.
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after
344 const IPC::Message& create_message, 344 const IPC::Message& create_message,
345 const IPC::Message& browser_host_create_message) { 345 const IPC::Message& browser_host_create_message) {
346 scoped_refptr<HostResourceVar> result = 346 scoped_refptr<HostResourceVar> result =
347 CreateResourceVar(pending_renderer_id, create_message); 347 CreateResourceVar(pending_renderer_id, create_message);
348 browser_host_create_messages_.push_back(browser_host_create_message); 348 browser_host_create_messages_.push_back(browser_host_create_message);
349 browser_vars_.push_back(result); 349 browser_vars_.push_back(result);
350 return result; 350 return result;
351 } 351 }
352 352
353 } // namespace content 353 } // namespace content
OLDNEW
« no previous file with comments | « content/renderer/pepper/resource_converter.h ('k') | content/renderer/pepper/v8_var_converter.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698