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

Side by Side Diff: src/platform/window_manager/main.cc

Issue 2121012: Simplify libcrash_dumper interface and make window_manager gen crash dumps (Closed) Base URL: ssh://git@chromiumos-git//chromeos
Patch Set: Change crash dumper lib name Created 10 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
« no previous file with comments | « src/platform/window_manager/SConstruct ('k') | no next file » | 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) 2010 The Chromium OS Authors. All rights reserved. 1 // Copyright (c) 2010 The Chromium OS 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 <unistd.h> 5 #include <unistd.h>
6 6
7 #include <cmath> 7 #include <cmath>
8 #include <cstdlib> 8 #include <cstdlib>
9 #include <ctime> 9 #include <ctime>
10 10
11 extern "C" { 11 extern "C" {
12 #include <X11/Xlib.h> 12 #include <X11/Xlib.h>
13 } 13 }
14 14
15 #include <gflags/gflags.h> 15 #include <gflags/gflags.h>
16 16
17 #include "base/command_line.h" 17 #include "base/command_line.h"
18 #include "base/file_path.h" 18 #include "base/file_path.h"
19 #include "base/file_util.h" 19 #include "base/file_util.h"
20 #include "base/logging.h" 20 #include "base/logging.h"
21 #include "base/scoped_ptr.h" 21 #include "base/scoped_ptr.h"
22 #include "base/string_util.h" 22 #include "base/string_util.h"
23 #ifdef USE_BREAKPAD
24 #include "handler/exception_handler.h"
25 #endif
26 #include "window_manager/callback.h" 23 #include "window_manager/callback.h"
27 #include "window_manager/compositor.h" 24 #include "window_manager/compositor.h"
28 #include "window_manager/event_loop.h" 25 #include "window_manager/event_loop.h"
29 #include "window_manager/real_compositor.h" 26 #include "window_manager/real_compositor.h"
30 #if defined(COMPOSITOR_OPENGL) 27 #if defined(COMPOSITOR_OPENGL)
31 #include "window_manager/real_gl_interface.h" 28 #include "window_manager/real_gl_interface.h"
32 #elif defined(COMPOSITOR_OPENGLES) 29 #elif defined(COMPOSITOR_OPENGLES)
33 #include "window_manager/gles/real_gles2_interface.h" 30 #include "window_manager/gles/real_gles2_interface.h"
34 #endif 31 #endif
35 #include "window_manager/real_x_connection.h" 32 #include "window_manager/real_x_connection.h"
36 #include "window_manager/util.h" 33 #include "window_manager/util.h"
37 #include "window_manager/window_manager.h" 34 #include "window_manager/window_manager.h"
38 35
39 DECLARE_bool(wm_use_compositing); // from window_manager.cc 36 DECLARE_bool(wm_use_compositing); // from window_manager.cc
40 37
41 DEFINE_string(log_dir, ".", 38 DEFINE_string(log_dir, ".",
42 "Directory where logs should be written; created if it doesn't " 39 "Directory where logs should be written; created if it doesn't "
43 "exist."); 40 "exist.");
44 DEFINE_string(display, "", 41 DEFINE_string(display, "",
45 "X Display to connect to (overrides DISPLAY env var)."); 42 "X Display to connect to (overrides DISPLAY env var).");
46 DEFINE_bool(logtostderr, false, 43 DEFINE_bool(logtostderr, false,
47 "Write logs to stderr instead of to a file in log_dir."); 44 "Write logs to stderr instead of to a file in log_dir.");
48 DEFINE_string(minidump_dir, ".",
49 "Directory where crash minidumps should be written; created if "
50 "it doesn't exist.");
51 DEFINE_int32(pause_at_start, 0, 45 DEFINE_int32(pause_at_start, 0,
52 "Specify this to pause for N seconds at startup."); 46 "Specify this to pause for N seconds at startup.");
53 DEFINE_bool(logged_in, true, "Whether Chrome is logged in or not."); 47 DEFINE_bool(logged_in, true, "Whether Chrome is logged in or not.");
54 48
55 using std::string; 49 using std::string;
56 using window_manager::Compositor; 50 using window_manager::Compositor;
57 using window_manager::EventLoop; 51 using window_manager::EventLoop;
58 using window_manager::GetTimeAsString; 52 using window_manager::GetTimeAsString;
59 using window_manager::MockCompositor; 53 using window_manager::MockCompositor;
60 using window_manager::RealCompositor; 54 using window_manager::RealCompositor;
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
94 88
95 int main(int argc, char** argv) { 89 int main(int argc, char** argv) {
96 google::ParseCommandLineFlags(&argc, &argv, true); 90 google::ParseCommandLineFlags(&argc, &argv, true);
97 if (!FLAGS_display.empty()) 91 if (!FLAGS_display.empty())
98 setenv("DISPLAY", FLAGS_display.c_str(), 1); 92 setenv("DISPLAY", FLAGS_display.c_str(), 1);
99 93
100 CommandLine::Init(argc, argv); 94 CommandLine::Init(argc, argv);
101 if (FLAGS_pause_at_start > 0) 95 if (FLAGS_pause_at_start > 0)
102 sleep(FLAGS_pause_at_start); 96 sleep(FLAGS_pause_at_start);
103 97
104 #ifdef USE_BREAKPAD
105 if (!file_util::CreateDirectory(FilePath(FLAGS_minidump_dir)))
106 LOG(ERROR) << "Unable to create minidump directory " << FLAGS_minidump_dir;
107 google_breakpad::ExceptionHandler exception_handler(
108 FLAGS_minidump_dir, NULL, NULL, NULL, true);
109 #endif
110
111 const string log_basename = StringPrintf( 98 const string log_basename = StringPrintf(
112 "%s.%s", WindowManager::GetWmName(), 99 "%s.%s", WindowManager::GetWmName(),
113 GetTimeAsString(::time(NULL)).c_str()); 100 GetTimeAsString(::time(NULL)).c_str());
114 if (!FLAGS_logtostderr) { 101 if (!FLAGS_logtostderr) {
115 if (!file_util::CreateDirectory(FilePath(FLAGS_log_dir))) { 102 if (!file_util::CreateDirectory(FilePath(FLAGS_log_dir))) {
116 LOG(ERROR) << "Unable to create logging directory " << FLAGS_log_dir; 103 LOG(ERROR) << "Unable to create logging directory " << FLAGS_log_dir;
117 } else { 104 } else {
118 SetUpLogSymlink(StringPrintf("%s/%s.LATEST", 105 SetUpLogSymlink(StringPrintf("%s/%s.LATEST",
119 FLAGS_log_dir.c_str(), 106 FLAGS_log_dir.c_str(),
120 WindowManager::GetWmName()), 107 WindowManager::GetWmName()),
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after
176 const int x11_fd = xconn.GetConnectionFileDescriptor(); 163 const int x11_fd = xconn.GetConnectionFileDescriptor();
177 LOG(INFO) << "X11 connection is on fd " << x11_fd; 164 LOG(INFO) << "X11 connection is on fd " << x11_fd;
178 event_loop.AddFileDescriptor( 165 event_loop.AddFileDescriptor(
179 x11_fd, NewPermanentCallback(&wm, &WindowManager::ProcessPendingEvents)); 166 x11_fd, NewPermanentCallback(&wm, &WindowManager::ProcessPendingEvents));
180 event_loop.AddPrePollCallback( 167 event_loop.AddPrePollCallback(
181 NewPermanentCallback(&wm, &WindowManager::ProcessPendingEvents)); 168 NewPermanentCallback(&wm, &WindowManager::ProcessPendingEvents));
182 169
183 event_loop.Run(); 170 event_loop.Run();
184 return 0; 171 return 0;
185 } 172 }
OLDNEW
« no previous file with comments | « src/platform/window_manager/SConstruct ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698