| 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 |
| (...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 75 } | 75 } |
| 76 base::MessageLoopForUI::current()->Attach(); | 76 base::MessageLoopForUI::current()->Attach(); |
| 77 | 77 |
| 78 InitializeMainThread(); | 78 InitializeMainThread(); |
| 79 | 79 |
| 80 #if 0 | 80 #if 0 |
| 81 // TODO(crbug.com/228014): SystemMonitor is not working properly on iOS. | 81 // TODO(crbug.com/228014): SystemMonitor is not working properly on iOS. |
| 82 system_monitor_.reset(new base::SystemMonitor); | 82 system_monitor_.reset(new base::SystemMonitor); |
| 83 #endif | 83 #endif |
| 84 // TODO(rohitrao): Do we need PowerMonitor on iOS, or can we get rid of it? | 84 // TODO(rohitrao): Do we need PowerMonitor on iOS, or can we get rid of it? |
| 85 scoped_ptr<base::PowerMonitorSource> power_monitor_source( | 85 std::unique_ptr<base::PowerMonitorSource> power_monitor_source( |
| 86 new base::PowerMonitorDeviceSource()); | 86 new base::PowerMonitorDeviceSource()); |
| 87 power_monitor_.reset(new base::PowerMonitor(std::move(power_monitor_source))); | 87 power_monitor_.reset(new base::PowerMonitor(std::move(power_monitor_source))); |
| 88 network_change_notifier_.reset(net::NetworkChangeNotifier::Create()); | 88 network_change_notifier_.reset(net::NetworkChangeNotifier::Create()); |
| 89 | 89 |
| 90 if (parts_) { | 90 if (parts_) { |
| 91 parts_->PostMainMessageLoopStart(); | 91 parts_->PostMainMessageLoopStart(); |
| 92 } | 92 } |
| 93 } | 93 } |
| 94 | 94 |
| 95 void WebMainLoop::CreateStartupTasks() { | 95 void WebMainLoop::CreateStartupTasks() { |
| (...skipping 27 matching lines...) Expand all Loading... |
| 123 base::Thread::Options io_message_loop_options; | 123 base::Thread::Options io_message_loop_options; |
| 124 io_message_loop_options.message_loop_type = base::MessageLoop::TYPE_IO; | 124 io_message_loop_options.message_loop_type = base::MessageLoop::TYPE_IO; |
| 125 | 125 |
| 126 // Start threads in the order they occur in the WebThread::ID | 126 // Start threads in the order they occur in the WebThread::ID |
| 127 // enumeration, except for WebThread::UI which is the main | 127 // enumeration, except for WebThread::UI which is the main |
| 128 // thread. | 128 // thread. |
| 129 // | 129 // |
| 130 // Must be size_t so we can increment it. | 130 // Must be size_t so we can increment it. |
| 131 for (size_t thread_id = WebThread::UI + 1; thread_id < WebThread::ID_COUNT; | 131 for (size_t thread_id = WebThread::UI + 1; thread_id < WebThread::ID_COUNT; |
| 132 ++thread_id) { | 132 ++thread_id) { |
| 133 scoped_ptr<WebThreadImpl>* thread_to_start = nullptr; | 133 std::unique_ptr<WebThreadImpl>* thread_to_start = nullptr; |
| 134 base::Thread::Options options; | 134 base::Thread::Options options; |
| 135 | 135 |
| 136 switch (thread_id) { | 136 switch (thread_id) { |
| 137 // TODO(rohitrao): We probably do not need all of these threads. Remove | 137 // TODO(rohitrao): We probably do not need all of these threads. Remove |
| 138 // the ones that serve no purpose. http://crbug.com/365909 | 138 // the ones that serve no purpose. http://crbug.com/365909 |
| 139 case WebThread::DB: | 139 case WebThread::DB: |
| 140 thread_to_start = &db_thread_; | 140 thread_to_start = &db_thread_; |
| 141 options.timer_slack = base::TIMER_SLACK_MAXIMUM; | 141 options.timer_slack = base::TIMER_SLACK_MAXIMUM; |
| 142 break; | 142 break; |
| 143 case WebThread::FILE_USER_BLOCKING: | 143 case WebThread::FILE_USER_BLOCKING: |
| (...skipping 129 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 273 main_thread_.reset( | 273 main_thread_.reset( |
| 274 new WebThreadImpl(WebThread::UI, base::MessageLoop::current())); | 274 new WebThreadImpl(WebThread::UI, base::MessageLoop::current())); |
| 275 } | 275 } |
| 276 | 276 |
| 277 int WebMainLoop::WebThreadsStarted() { | 277 int WebMainLoop::WebThreadsStarted() { |
| 278 cookie_notification_bridge_.reset(new CookieNotificationBridge); | 278 cookie_notification_bridge_.reset(new CookieNotificationBridge); |
| 279 return result_code_; | 279 return result_code_; |
| 280 } | 280 } |
| 281 | 281 |
| 282 } // namespace web | 282 } // namespace web |
| OLD | NEW |