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

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

Issue 1830853002: Make PlatformFileForTransit a class on Windows. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Comments from mseaborn. Created 4 years, 8 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 "components/nacl/renderer/ppb_nacl_private.h" 5 #include "components/nacl/renderer/ppb_nacl_private.h"
6 6
7 #include <stddef.h> 7 #include <stddef.h>
8 #include <stdint.h> 8 #include <stdint.h>
9 #include <numeric> 9 #include <numeric>
10 #include <string> 10 #include <string>
11 #include <utility> 11 #include <utility>
12 #include <vector> 12 #include <vector>
13 13
14 #include "base/bind.h" 14 #include "base/bind.h"
15 #include "base/bind_helpers.h" 15 #include "base/bind_helpers.h"
16 #include "base/command_line.h" 16 #include "base/command_line.h"
17 #include "base/containers/scoped_ptr_hash_map.h" 17 #include "base/containers/scoped_ptr_hash_map.h"
18 #include "base/cpu.h" 18 #include "base/cpu.h"
19 #include "base/files/file.h" 19 #include "base/files/file.h"
20 #include "base/json/json_reader.h" 20 #include "base/json/json_reader.h"
21 #include "base/lazy_instance.h" 21 #include "base/lazy_instance.h"
22 #include "base/location.h" 22 #include "base/location.h"
23 #include "base/logging.h" 23 #include "base/logging.h"
24 #include "base/macros.h" 24 #include "base/macros.h"
25 #include "base/process/process_handle.h"
25 #include "base/single_thread_task_runner.h" 26 #include "base/single_thread_task_runner.h"
26 #include "base/strings/string_split.h" 27 #include "base/strings/string_split.h"
27 #include "base/strings/string_util.h" 28 #include "base/strings/string_util.h"
28 #include "base/thread_task_runner_handle.h" 29 #include "base/thread_task_runner_handle.h"
29 #include "build/build_config.h" 30 #include "build/build_config.h"
30 #include "components/nacl/common/nacl_host_messages.h" 31 #include "components/nacl/common/nacl_host_messages.h"
31 #include "components/nacl/common/nacl_messages.h" 32 #include "components/nacl/common/nacl_messages.h"
32 #include "components/nacl/common/nacl_nonsfi_util.h" 33 #include "components/nacl/common/nacl_nonsfi_util.h"
33 #include "components/nacl/common/nacl_switches.h" 34 #include "components/nacl/common/nacl_switches.h"
34 #include "components/nacl/common/nacl_types.h" 35 #include "components/nacl/common/nacl_types.h"
(...skipping 429 matching lines...) Expand 10 before | Expand all | Expand 10 after
464 } 465 }
465 } 466 }
466 } 467 }
467 468
468 IPC::PlatformFileForTransit nexe_for_transit = 469 IPC::PlatformFileForTransit nexe_for_transit =
469 IPC::InvalidPlatformFileForTransit(); 470 IPC::InvalidPlatformFileForTransit();
470 #if defined(OS_POSIX) 471 #if defined(OS_POSIX)
471 if (nexe_file_info->handle != PP_kInvalidFileHandle) 472 if (nexe_file_info->handle != PP_kInvalidFileHandle)
472 nexe_for_transit = base::FileDescriptor(nexe_file_info->handle, true); 473 nexe_for_transit = base::FileDescriptor(nexe_file_info->handle, true);
473 #elif defined(OS_WIN) 474 #elif defined(OS_WIN)
474 // Duplicate the handle on the browser side instead of the renderer. 475 nexe_for_transit = IPC::PlatformFileForTransit(nexe_file_info->handle,
475 // This is because BrokerGetFileForProcess isn't part of content/public, and 476 base::GetCurrentProcId());
476 // it's simpler to do the duplication in the browser anyway.
477 nexe_for_transit = nexe_file_info->handle;
478 #else 477 #else
479 # error Unsupported target platform. 478 # error Unsupported target platform.
480 #endif 479 #endif
481 480
482 std::string error_message_string; 481 std::string error_message_string;
483 NaClLaunchResult launch_result; 482 NaClLaunchResult launch_result;
484 if (!sender->Send(new NaClHostMsg_LaunchNaCl( 483 if (!sender->Send(new NaClHostMsg_LaunchNaCl(
485 NaClLaunchParams( 484 NaClLaunchParams(
486 instance_info.url.spec(), 485 instance_info.url.spec(),
487 nexe_for_transit, 486 nexe_for_transit,
(...skipping 1279 matching lines...) Expand 10 before | Expand all | Expand 10 after
1767 // Mark the request as requesting a PNaCl bitcode file, 1766 // Mark the request as requesting a PNaCl bitcode file,
1768 // so that component updater can detect this user action. 1767 // so that component updater can detect this user action.
1769 url_request.addHTTPHeaderField( 1768 url_request.addHTTPHeaderField(
1770 blink::WebString::fromUTF8("Accept"), 1769 blink::WebString::fromUTF8("Accept"),
1771 blink::WebString::fromUTF8("application/x-pnacl, */*")); 1770 blink::WebString::fromUTF8("application/x-pnacl, */*"));
1772 url_request.setRequestContext(blink::WebURLRequest::RequestContextObject); 1771 url_request.setRequestContext(blink::WebURLRequest::RequestContextObject);
1773 downloader->Load(url_request); 1772 downloader->Load(url_request);
1774 } 1773 }
1775 1774
1776 } // namespace nacl 1775 } // namespace nacl
OLDNEW
« no previous file with comments | « components/nacl/renderer/plugin/pnacl_translate_thread.cc ('k') | content/child/mojo/mojo_application.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698