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

Side by Side Diff: components/nacl/renderer/ppb_nacl_private_impl.cc

Issue 418423002: Pepper: Stop using SRPC for irt_open_resource(). (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 3 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
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 "components/nacl/renderer/ppb_nacl_private_impl.h" 5 #include "components/nacl/renderer/ppb_nacl_private_impl.h"
6 6
7 #include <numeric> 7 #include <numeric>
8 #include <string> 8 #include <string>
9 #include <vector> 9 #include <vector>
10 10
(...skipping 185 matching lines...) Expand 10 before | Expand all | Expand 10 after
196 std::string url; 196 std::string url;
197 // TODO(teravest): Clean up pnacl_options logic in JsonManifest so we don't 197 // TODO(teravest): Clean up pnacl_options logic in JsonManifest so we don't
198 // have to initialize it like this here. 198 // have to initialize it like this here.
199 PP_PNaClOptions pnacl_options; 199 PP_PNaClOptions pnacl_options;
200 pnacl_options.translate = PP_FALSE; 200 pnacl_options.translate = PP_FALSE;
201 pnacl_options.is_debug = PP_FALSE; 201 pnacl_options.is_debug = PP_FALSE;
202 pnacl_options.opt_level = 2; 202 pnacl_options.opt_level = 2;
203 if (!ManifestResolveKey(pp_instance_, false, key, &url, &pnacl_options)) { 203 if (!ManifestResolveKey(pp_instance_, false, key, &url, &pnacl_options)) {
204 base::MessageLoop::current()->PostTask( 204 base::MessageLoop::current()->PostTask(
205 FROM_HERE, 205 FROM_HERE,
206 base::Bind(callback, base::Passed(base::File()))); 206 base::Bind(callback, base::Passed(base::File()), 0, 0));
207 return; 207 return;
208 } 208 }
209 209
210 // We have to call DidDownloadFile, even if this object is destroyed, so 210 // We have to call DidDownloadFile, even if this object is destroyed, so
211 // that the handle inside PP_NaClFileInfo isn't leaked. This means that the 211 // that the handle inside PP_NaClFileInfo isn't leaked. This means that the
212 // callback passed to this function shouldn't have a weak pointer to an 212 // callback passed to this function shouldn't have a weak pointer to an
213 // object either. 213 // object either.
214 // 214 //
215 // TODO(teravest): Make a type like PP_NaClFileInfo to use for DownloadFile 215 // TODO(teravest): Make a type like PP_NaClFileInfo to use for DownloadFile
216 // that would close the file handle on destruction. 216 // that would close the file handle on destruction.
217 DownloadFile(pp_instance_, url, 217 DownloadFile(pp_instance_, url,
218 base::Bind(&ManifestServiceProxy::DidDownloadFile, callback)); 218 base::Bind(&ManifestServiceProxy::DidDownloadFile, callback));
219 } 219 }
220 220
221 private: 221 private:
222 static void DidDownloadFile( 222 static void DidDownloadFile(
223 ManifestServiceChannel::OpenResourceCallback callback, 223 ManifestServiceChannel::OpenResourceCallback callback,
224 int32_t pp_error, 224 int32_t pp_error,
225 const PP_NaClFileInfo& file_info) { 225 const PP_NaClFileInfo& file_info) {
226 if (pp_error != PP_OK) { 226 if (pp_error != PP_OK) {
227 callback.Run(base::File()); 227 callback.Run(base::File(), 0, 0);
228 return; 228 return;
229 } 229 }
230 callback.Run(base::File(file_info.handle)); 230 callback.Run(base::File(file_info.handle),
231 file_info.token_lo,
232 file_info.token_hi);
231 } 233 }
232 234
233 PP_Instance pp_instance_; 235 PP_Instance pp_instance_;
234 DISALLOW_COPY_AND_ASSIGN(ManifestServiceProxy); 236 DISALLOW_COPY_AND_ASSIGN(ManifestServiceProxy);
235 }; 237 };
236 238
237 blink::WebURLLoader* CreateWebURLLoader(const blink::WebDocument& document, 239 blink::WebURLLoader* CreateWebURLLoader(const blink::WebDocument& document,
238 const GURL& gurl) { 240 const GURL& gurl) {
239 blink::WebURLLoaderOptions options; 241 blink::WebURLLoaderOptions options;
240 options.untrustedHTTP = true; 242 options.untrustedHTTP = true;
(...skipping 173 matching lines...) Expand 10 before | Expand all | Expand 10 after
414 content::RenderThread::Get()->GetShutdownEvent(), 416 content::RenderThread::Get()->GetShutdownEvent(),
415 report_exit_status)); 417 report_exit_status));
416 load_manager->set_trusted_plugin_channel(trusted_plugin_channel.Pass()); 418 load_manager->set_trusted_plugin_channel(trusted_plugin_channel.Pass());
417 } else { 419 } else {
418 PostPPCompletionCallback(callback, PP_ERROR_FAILED); 420 PostPPCompletionCallback(callback, PP_ERROR_FAILED);
419 return; 421 return;
420 } 422 }
421 423
422 // Create the manifest service handle as well. 424 // Create the manifest service handle as well.
423 // For security hardening, disable the IPCs for open_resource() when they 425 // For security hardening, disable the IPCs for open_resource() when they
424 // aren't needed. PNaCl doesn't expose open_resource(), and the new 426 // aren't needed. PNaCl doesn't expose open_resource(). Note that
425 // open_resource() IPCs are currently only used for Non-SFI NaCl so far, 427 // enable_dyncode_syscalls is true if and only if the plugin is a non-PNaCl
426 // not SFI NaCl. Note that enable_dyncode_syscalls is true if and only if 428 // plugin.
427 // the plugin is a non-PNaCl plugin.
428 if (load_manager && 429 if (load_manager &&
429 enable_dyncode_syscalls && 430 enable_dyncode_syscalls &&
430 uses_nonsfi_mode &&
431 IsValidChannelHandle( 431 IsValidChannelHandle(
432 launch_result.manifest_service_ipc_channel_handle)) { 432 launch_result.manifest_service_ipc_channel_handle)) {
433 scoped_ptr<ManifestServiceChannel> manifest_service_channel( 433 scoped_ptr<ManifestServiceChannel> manifest_service_channel(
434 new ManifestServiceChannel( 434 new ManifestServiceChannel(
435 launch_result.manifest_service_ipc_channel_handle, 435 launch_result.manifest_service_ipc_channel_handle,
436 base::Bind(&PostPPCompletionCallback, callback), 436 base::Bind(&PostPPCompletionCallback, callback),
437 manifest_service_proxy.Pass(), 437 manifest_service_proxy.Pass(),
438 content::RenderThread::Get()->GetShutdownEvent())); 438 content::RenderThread::Get()->GetShutdownEvent()));
439 load_manager->set_manifest_service_channel( 439 load_manager->set_manifest_service_channel(
440 manifest_service_channel.Pass()); 440 manifest_service_channel.Pass());
(...skipping 1269 matching lines...) Expand 10 before | Expand all | Expand 10 after
1710 &StreamPexe 1710 &StreamPexe
1711 }; 1711 };
1712 1712
1713 } // namespace 1713 } // namespace
1714 1714
1715 const PPB_NaCl_Private* GetNaClPrivateInterface() { 1715 const PPB_NaCl_Private* GetNaClPrivateInterface() {
1716 return &nacl_interface; 1716 return &nacl_interface;
1717 } 1717 }
1718 1718
1719 } // namespace nacl 1719 } // namespace nacl
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698