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

Side by Side Diff: content/browser/browser_main_loop.cc

Issue 10914279: Cleanup: Add a const variable for /proc/self/exe. (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: Created 8 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
« no previous file with comments | « chrome/test/base/chrome_test_suite.cc ('k') | content/common/child_process_host_impl.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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/browser/browser_main_loop.h" 5 #include "content/browser/browser_main_loop.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/command_line.h" 8 #include "base/command_line.h"
9 #include "base/debug/trace_event.h" 9 #include "base/debug/trace_event.h"
10 #include "base/hi_res_timer_manager.h" 10 #include "base/hi_res_timer_manager.h"
(...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after
74 #if defined(OS_CHROMEOS) 74 #if defined(OS_CHROMEOS)
75 #include <dbus/dbus-glib.h> 75 #include <dbus/dbus-glib.h>
76 #endif 76 #endif
77 77
78 #if defined(TOOLKIT_GTK) 78 #if defined(TOOLKIT_GTK)
79 #include "ui/gfx/gtk_util.h" 79 #include "ui/gfx/gtk_util.h"
80 #endif 80 #endif
81 81
82 #if defined(OS_POSIX) && !defined(OS_MACOSX) 82 #if defined(OS_POSIX) && !defined(OS_MACOSX)
83 #include <sys/stat.h> 83 #include <sys/stat.h>
84
85 #include "base/process_util.h"
84 #include "content/browser/renderer_host/render_sandbox_host_linux.h" 86 #include "content/browser/renderer_host/render_sandbox_host_linux.h"
85 #include "content/browser/zygote_host/zygote_host_impl_linux.h" 87 #include "content/browser/zygote_host/zygote_host_impl_linux.h"
86 #endif 88 #endif
87 89
88 #if defined(USE_X11) 90 #if defined(USE_X11)
89 #include <X11/Xlib.h> 91 #include <X11/Xlib.h>
90 #endif 92 #endif
91 93
92 // One of the linux specific headers defines this as a macro. 94 // One of the linux specific headers defines this as a macro.
93 #ifdef DestroyAll 95 #ifdef DestroyAll
94 #undef DestroyAll 96 #undef DestroyAll
95 #endif 97 #endif
96 98
97 using content::TraceControllerImpl; 99 using content::TraceControllerImpl;
98 100
99 namespace { 101 namespace {
100 102
101 #if defined(OS_POSIX) && !defined(OS_MACOSX) && !defined(OS_ANDROID) 103 #if defined(OS_POSIX) && !defined(OS_MACOSX) && !defined(OS_ANDROID)
102 void SetupSandbox(const CommandLine& parsed_command_line) { 104 void SetupSandbox(const CommandLine& parsed_command_line) {
103 // TODO(evanm): move this into SandboxWrapper; I'm just trying to move this 105 // TODO(evanm): move this into SandboxWrapper; I'm just trying to move this
104 // code en masse out of chrome_main for now. 106 // code en masse out of chrome_main for now.
105 const char* sandbox_binary = NULL; 107 const char* sandbox_binary = NULL;
106 struct stat st; 108 struct stat st;
107 109
108 // In Chromium branded builds, developers can set an environment variable to 110 // In Chromium branded builds, developers can set an environment variable to
109 // use the development sandbox. See 111 // use the development sandbox. See
110 // http://code.google.com/p/chromium/wiki/LinuxSUIDSandboxDevelopment 112 // http://code.google.com/p/chromium/wiki/LinuxSUIDSandboxDevelopment
111 if (stat("/proc/self/exe", &st) == 0 && st.st_uid == getuid()) 113 if (stat(base::kProcSelfExe, &st) == 0 && st.st_uid == getuid())
112 sandbox_binary = getenv("CHROME_DEVEL_SANDBOX"); 114 sandbox_binary = getenv("CHROME_DEVEL_SANDBOX");
113 115
114 #if defined(LINUX_SANDBOX_PATH) 116 #if defined(LINUX_SANDBOX_PATH)
115 if (!sandbox_binary) 117 if (!sandbox_binary)
116 sandbox_binary = LINUX_SANDBOX_PATH; 118 sandbox_binary = LINUX_SANDBOX_PATH;
117 #endif 119 #endif
118 120
119 std::string sandbox_cmd; 121 std::string sandbox_cmd;
120 if (sandbox_binary && !parsed_command_line.HasSwitch(switches::kNoSandbox)) 122 if (sandbox_binary && !parsed_command_line.HasSwitch(switches::kNoSandbox))
121 sandbox_cmd = sandbox_binary; 123 sandbox_cmd = sandbox_binary;
(...skipping 600 matching lines...) Expand 10 before | Expand all | Expand 10 after
722 DCHECK_EQ(MessageLoop::TYPE_UI, MessageLoop::current()->type()); 724 DCHECK_EQ(MessageLoop::TYPE_UI, MessageLoop::current()->type());
723 if (parameters_.ui_task) 725 if (parameters_.ui_task)
724 MessageLoopForUI::current()->PostTask(FROM_HERE, *parameters_.ui_task); 726 MessageLoopForUI::current()->PostTask(FROM_HERE, *parameters_.ui_task);
725 727
726 base::RunLoop run_loop; 728 base::RunLoop run_loop;
727 run_loop.Run(); 729 run_loop.Run();
728 #endif 730 #endif
729 } 731 }
730 732
731 } // namespace content 733 } // namespace content
OLDNEW
« no previous file with comments | « chrome/test/base/chrome_test_suite.cc ('k') | content/common/child_process_host_impl.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698