OLD | NEW |
1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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 "components/arc/arc_bridge_service_impl.h" | 5 #include "components/arc/arc_bridge_service_impl.h" |
6 | 6 |
7 #include <string> | 7 #include <string> |
8 #include <utility> | 8 #include <utility> |
9 | 9 |
10 #include "base/command_line.h" | 10 #include "base/command_line.h" |
11 #include "base/json/json_writer.h" | 11 #include "base/json/json_writer.h" |
12 #include "base/message_loop/message_loop.h" | |
13 #include "base/sequenced_task_runner.h" | 12 #include "base/sequenced_task_runner.h" |
14 #include "base/sys_info.h" | 13 #include "base/sys_info.h" |
15 #include "base/task_runner_util.h" | 14 #include "base/task_runner_util.h" |
16 #include "base/threading/thread_task_runner_handle.h" | 15 #include "base/threading/thread_task_runner_handle.h" |
17 #include "base/time/time.h" | 16 #include "base/time/time.h" |
18 #include "chromeos/chromeos_switches.h" | 17 #include "chromeos/chromeos_switches.h" |
19 #include "chromeos/dbus/dbus_method_call_status.h" | 18 #include "chromeos/dbus/dbus_method_call_status.h" |
20 #include "chromeos/dbus/dbus_thread_manager.h" | 19 #include "chromeos/dbus/dbus_thread_manager.h" |
21 #include "components/arc/arc_bridge_host_impl.h" | 20 #include "components/arc/arc_bridge_host_impl.h" |
22 #include "components/prefs/pref_registry_simple.h" | 21 #include "components/prefs/pref_registry_simple.h" |
(...skipping 118 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
141 | 140 |
142 if (reconnect_) { | 141 if (reconnect_) { |
143 // There was a previous invocation and it crashed for some reason. Try | 142 // There was a previous invocation and it crashed for some reason. Try |
144 // starting the container again. | 143 // starting the container again. |
145 reconnect_ = false; | 144 reconnect_ = false; |
146 VLOG(0) << "ARC reconnecting"; | 145 VLOG(0) << "ARC reconnecting"; |
147 if (use_delay_before_reconnecting_) { | 146 if (use_delay_before_reconnecting_) { |
148 // Instead of immediately trying to restart the container, give it some | 147 // Instead of immediately trying to restart the container, give it some |
149 // time to finish tearing down in case it is still in the process of | 148 // time to finish tearing down in case it is still in the process of |
150 // stopping. | 149 // stopping. |
151 base::MessageLoop::current()->task_runner()->PostDelayedTask( | 150 base::ThreadTaskRunnerHandle::Get()->PostDelayedTask( |
152 FROM_HERE, base::Bind(&ArcBridgeServiceImpl::PrerequisitesChanged, | 151 FROM_HERE, base::Bind(&ArcBridgeServiceImpl::PrerequisitesChanged, |
153 weak_factory_.GetWeakPtr()), | 152 weak_factory_.GetWeakPtr()), |
154 base::TimeDelta::FromSeconds(kReconnectDelayInSeconds)); | 153 base::TimeDelta::FromSeconds(kReconnectDelayInSeconds)); |
155 } else { | 154 } else { |
156 // Restart immediately. | 155 // Restart immediately. |
157 PrerequisitesChanged(); | 156 PrerequisitesChanged(); |
158 } | 157 } |
159 } | 158 } |
160 } | 159 } |
161 | 160 |
162 } // namespace arc | 161 } // namespace arc |
OLD | NEW |