OLD | NEW |
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 "content/shell/browser/shell_browser_main_parts.h" | 5 #include "content/shell/browser/shell_browser_main_parts.h" |
6 | 6 |
7 #include "base/base_switches.h" | 7 #include "base/base_switches.h" |
8 #include "base/bind.h" | 8 #include "base/bind.h" |
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" |
(...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
80 } // namespace | 80 } // namespace |
81 | 81 |
82 ShellBrowserMainParts::ShellBrowserMainParts( | 82 ShellBrowserMainParts::ShellBrowserMainParts( |
83 const MainFunctionParams& parameters) | 83 const MainFunctionParams& parameters) |
84 : parameters_(parameters), | 84 : parameters_(parameters), |
85 run_message_loop_(true), | 85 run_message_loop_(true), |
86 devtools_http_handler_(nullptr) { | 86 devtools_http_handler_(nullptr) { |
87 } | 87 } |
88 | 88 |
89 ShellBrowserMainParts::~ShellBrowserMainParts() { | 89 ShellBrowserMainParts::~ShellBrowserMainParts() { |
90 if (devtools_http_handler_) { | 90 DCHECK(!devtools_http_handler_); |
91 // Note that Stop destroys devtools_http_handler_. | |
92 devtools_http_handler_->Stop(); | |
93 } | |
94 } | 91 } |
95 | 92 |
96 #if !defined(OS_MACOSX) | 93 #if !defined(OS_MACOSX) |
97 void ShellBrowserMainParts::PreMainMessageLoopStart() { | 94 void ShellBrowserMainParts::PreMainMessageLoopStart() { |
98 #if defined(USE_AURA) && defined(USE_X11) | 95 #if defined(USE_AURA) && defined(USE_X11) |
99 ui::TouchFactory::SetTouchDeviceListFromCommandLine(); | 96 ui::TouchFactory::SetTouchDeviceListFromCommandLine(); |
100 #endif | 97 #endif |
101 } | 98 } |
102 #endif | 99 #endif |
103 | 100 |
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
140 switches::kCrashDumpsDir); | 137 switches::kCrashDumpsDir); |
141 crash_dump_manager_.reset(new breakpad::CrashDumpManager(crash_dumps_dir)); | 138 crash_dump_manager_.reset(new breakpad::CrashDumpManager(crash_dumps_dir)); |
142 } | 139 } |
143 #endif | 140 #endif |
144 | 141 |
145 net_log_.reset(new ShellNetLog("content_shell")); | 142 net_log_.reset(new ShellNetLog("content_shell")); |
146 InitializeBrowserContexts(); | 143 InitializeBrowserContexts(); |
147 Shell::Initialize(); | 144 Shell::Initialize(); |
148 net::NetModule::SetResourceProvider(PlatformResourceProvider); | 145 net::NetModule::SetResourceProvider(PlatformResourceProvider); |
149 | 146 |
150 // CreateHttpHandler retains ownership over DevToolsHttpHandler. | 147 devtools_http_handler_.reset( |
151 devtools_http_handler_ = | 148 ShellDevToolsManagerDelegate::CreateHttpHandler(browser_context_.get())); |
152 ShellDevToolsManagerDelegate::CreateHttpHandler(browser_context_.get()); | |
153 | 149 |
154 InitializeMessageLoopContext(); | 150 InitializeMessageLoopContext(); |
155 | 151 |
156 if (parameters_.ui_task) { | 152 if (parameters_.ui_task) { |
157 parameters_.ui_task->Run(); | 153 parameters_.ui_task->Run(); |
158 delete parameters_.ui_task; | 154 delete parameters_.ui_task; |
159 run_message_loop_ = false; | 155 run_message_loop_ = false; |
160 } | 156 } |
161 } | 157 } |
162 | 158 |
163 bool ShellBrowserMainParts::MainMessageLoopRun(int* result_code) { | 159 bool ShellBrowserMainParts::MainMessageLoopRun(int* result_code) { |
164 return !run_message_loop_; | 160 return !run_message_loop_; |
165 } | 161 } |
166 | 162 |
167 void ShellBrowserMainParts::PostMainMessageLoopRun() { | 163 void ShellBrowserMainParts::PostMainMessageLoopRun() { |
168 if (devtools_http_handler_) { | 164 devtools_http_handler_.reset(); |
169 // Note that Stop destroys devtools_http_handler_. | |
170 devtools_http_handler_->Stop(); | |
171 devtools_http_handler_ = nullptr; | |
172 } | |
173 browser_context_.reset(); | 165 browser_context_.reset(); |
174 off_the_record_browser_context_.reset(); | 166 off_the_record_browser_context_.reset(); |
175 } | 167 } |
176 | 168 |
177 } // namespace | 169 } // namespace |
OLD | NEW |