OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 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 "ios/web/app/web_main_loop.h" | 5 #include "ios/web/app/web_main_loop.h" |
6 | 6 |
7 #include <stddef.h> | 7 #include <stddef.h> |
8 | 8 |
9 #include <utility> | 9 #include <utility> |
10 | 10 |
11 #include "base/bind.h" | 11 #include "base/bind.h" |
12 #include "base/command_line.h" | 12 #include "base/command_line.h" |
13 #include "base/logging.h" | 13 #include "base/logging.h" |
14 #include "base/message_loop/message_loop.h" | 14 #include "base/message_loop/message_loop.h" |
15 #include "base/metrics/histogram.h" | 15 #include "base/metrics/histogram.h" |
16 #include "base/path_service.h" | 16 #include "base/path_service.h" |
17 #include "base/power_monitor/power_monitor.h" | 17 #include "base/power_monitor/power_monitor.h" |
18 #include "base/power_monitor/power_monitor_device_source.h" | 18 #include "base/power_monitor/power_monitor_device_source.h" |
19 #include "base/process/process_metrics.h" | 19 #include "base/process/process_metrics.h" |
20 #include "base/system_monitor/system_monitor.h" | 20 #include "base/system_monitor/system_monitor.h" |
21 #include "base/threading/thread_restrictions.h" | 21 #include "base/threading/thread_restrictions.h" |
22 #include "crypto/nss_util.h" | 22 #include "crypto/nss_util.h" |
23 #include "ios/web/net/cookie_notification_bridge.h" | 23 #include "ios/web/net/cookie_notification_bridge.h" |
24 #include "ios/web/public/app/web_main_parts.h" | 24 #include "ios/web/public/app/web_main_parts.h" |
25 #include "ios/web/public/web_client.h" | 25 #include "ios/web/public/web_client.h" |
26 #include "ios/web/web_thread_impl.h" | 26 #include "ios/web/web_thread_impl.h" |
| 27 #include "ios/web/webui/url_data_manager_ios.h" |
27 #include "net/base/network_change_notifier.h" | 28 #include "net/base/network_change_notifier.h" |
28 | 29 |
29 namespace web { | 30 namespace web { |
30 | 31 |
31 // The currently-running WebMainLoop. There can be one or zero. | 32 // The currently-running WebMainLoop. There can be one or zero. |
32 // TODO(rohitrao): Desktop uses this to implement | 33 // TODO(rohitrao): Desktop uses this to implement |
33 // ImmediateShutdownAndExitProcess. If we don't need that functionality, we can | 34 // ImmediateShutdownAndExitProcess. If we don't need that functionality, we can |
34 // remove this. | 35 // remove this. |
35 WebMainLoop* g_current_web_main_loop = nullptr; | 36 WebMainLoop* g_current_web_main_loop = nullptr; |
36 | 37 |
(...skipping 208 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
245 } | 246 } |
246 | 247 |
247 // Close the blocking I/O pool after the other threads. Other threads such | 248 // Close the blocking I/O pool after the other threads. Other threads such |
248 // as the I/O thread may need to schedule work like closing files or flushing | 249 // as the I/O thread may need to schedule work like closing files or flushing |
249 // data during shutdown, so the blocking pool needs to be available. There | 250 // data during shutdown, so the blocking pool needs to be available. There |
250 // may also be slow operations pending that will block shutdown, so closing | 251 // may also be slow operations pending that will block shutdown, so closing |
251 // it here (which will block until required operations are complete) gives | 252 // it here (which will block until required operations are complete) gives |
252 // more head start for those operations to finish. | 253 // more head start for those operations to finish. |
253 WebThreadImpl::ShutdownThreadPool(); | 254 WebThreadImpl::ShutdownThreadPool(); |
254 | 255 |
| 256 URLDataManagerIOS::DeleteDataSources(); |
| 257 |
255 if (parts_) { | 258 if (parts_) { |
256 parts_->PostDestroyThreads(); | 259 parts_->PostDestroyThreads(); |
257 } | 260 } |
258 } | 261 } |
259 | 262 |
260 void WebMainLoop::InitializeMainThread() { | 263 void WebMainLoop::InitializeMainThread() { |
261 const char* kThreadName = "CrWebMain"; | 264 const char* kThreadName = "CrWebMain"; |
262 base::PlatformThread::SetName(kThreadName); | 265 base::PlatformThread::SetName(kThreadName); |
263 if (main_message_loop_) { | 266 if (main_message_loop_) { |
264 main_message_loop_->set_thread_name(kThreadName); | 267 main_message_loop_->set_thread_name(kThreadName); |
265 } | 268 } |
266 | 269 |
267 // Register the main thread by instantiating it, but don't call any methods. | 270 // Register the main thread by instantiating it, but don't call any methods. |
268 main_thread_.reset( | 271 main_thread_.reset( |
269 new WebThreadImpl(WebThread::UI, base::MessageLoop::current())); | 272 new WebThreadImpl(WebThread::UI, base::MessageLoop::current())); |
270 } | 273 } |
271 | 274 |
272 int WebMainLoop::WebThreadsStarted() { | 275 int WebMainLoop::WebThreadsStarted() { |
273 cookie_notification_bridge_.reset(new CookieNotificationBridge); | 276 cookie_notification_bridge_.reset(new CookieNotificationBridge); |
274 return result_code_; | 277 return result_code_; |
275 } | 278 } |
276 | 279 |
277 } // namespace web | 280 } // namespace web |
OLD | NEW |