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

Side by Side Diff: chrome/app/chrome_watcher_command_line_win.cc

Issue 1422773008: Fixing remaining VC++ 2015 64-bit build breaks (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Some CR tweaks Created 5 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) 2014 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2014 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 "chrome/app/chrome_watcher_command_line_win.h" 5 #include "chrome/app/chrome_watcher_command_line_win.h"
6 6
7 #include <string> 7 #include <string>
8 8
9 #include "base/command_line.h" 9 #include "base/command_line.h"
10 #include "base/files/file_path.h" 10 #include "base/files/file_path.h"
11 #include "base/logging.h" 11 #include "base/logging.h"
12 #include "base/strings/string_number_conversions.h" 12 #include "base/strings/string_number_conversions.h"
13 #include "base/strings/stringprintf.h" 13 #include "base/strings/stringprintf.h"
14 #include "chrome/common/chrome_switches.h" 14 #include "chrome/common/chrome_switches.h"
15 #include "content/public/common/content_switches.h" 15 #include "content/public/common/content_switches.h"
16 16
17 namespace { 17 namespace {
18 18
19 const char kOnIninitializedEventHandleSwitch[] = "on-initialized-event-handle"; 19 const char kOnIninitializedEventHandleSwitch[] = "on-initialized-event-handle";
20 const char kParentHandleSwitch[] = "parent-handle"; 20 const char kParentHandleSwitch[] = "parent-handle";
21 const char kMainThreadIdSwitch[] = "main-thread-id"; 21 const char kMainThreadIdSwitch[] = "main-thread-id";
22 22
23 void AppendHandleSwitch(const std::string& switch_name, 23 void AppendHandleSwitch(const std::string& switch_name,
24 HANDLE handle, 24 HANDLE handle,
25 base::CommandLine* command_line) { 25 base::CommandLine* command_line) {
26 command_line->AppendSwitchASCII( 26 // Cast through uintptr_t and then uint32_t to make the truncation
27 switch_name, base::UintToString(reinterpret_cast<uint32_t>(handle))); 27 // explicit. Handles are size-of-pointer but are always 32-bit values.
28 command_line->AppendSwitchASCII(switch_name,
29 base::UintToString(static_cast<uint32_t>(
30 reinterpret_cast<uintptr_t>(handle))));
28 } 31 }
29 32
30 uint32_t ReadUintSwitch(const base::CommandLine& command_line, 33 uint32_t ReadUintSwitch(const base::CommandLine& command_line,
31 const std::string& switch_name) { 34 const std::string& switch_name) {
32 std::string switch_string = command_line.GetSwitchValueASCII(switch_name); 35 std::string switch_string = command_line.GetSwitchValueASCII(switch_name);
33 unsigned int switch_uint = 0; 36 unsigned int switch_uint = 0;
34 if (switch_string.empty() || 37 if (switch_string.empty() ||
35 !base::StringToUint(switch_string, &switch_uint)) { 38 !base::StringToUint(switch_string, &switch_uint)) {
36 DLOG(ERROR) << "Missing or invalid " << switch_name << " argument."; 39 DLOG(ERROR) << "Missing or invalid " << switch_name << " argument.";
37 return 0; 40 return 0;
(...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after
109 !parent_process->IsValid()) { 112 !parent_process->IsValid()) {
110 // If one was valid and not the other, free the valid one. 113 // If one was valid and not the other, free the valid one.
111 on_initialized_event->Close(); 114 on_initialized_event->Close();
112 parent_process->Close(); 115 parent_process->Close();
113 *main_thread_id = 0; 116 *main_thread_id = 0;
114 return false; 117 return false;
115 } 118 }
116 119
117 return true; 120 return true;
118 } 121 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698