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 "chromeos/dbus/session_manager_client.h" | 20 #include "chromeos/dbus/session_manager_client.h" |
22 #include "components/arc/arc_bridge_host_impl.h" | 21 #include "components/arc/arc_bridge_host_impl.h" |
(...skipping 107 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
130 | 129 |
131 if (reconnect_) { | 130 if (reconnect_) { |
132 // There was a previous invocation and it crashed for some reason. Try | 131 // There was a previous invocation and it crashed for some reason. Try |
133 // starting the container again. | 132 // starting the container again. |
134 reconnect_ = false; | 133 reconnect_ = false; |
135 VLOG(0) << "ARC reconnecting"; | 134 VLOG(0) << "ARC reconnecting"; |
136 if (use_delay_before_reconnecting_) { | 135 if (use_delay_before_reconnecting_) { |
137 // Instead of immediately trying to restart the container, give it some | 136 // Instead of immediately trying to restart the container, give it some |
138 // time to finish tearing down in case it is still in the process of | 137 // time to finish tearing down in case it is still in the process of |
139 // stopping. | 138 // stopping. |
140 base::MessageLoop::current()->task_runner()->PostDelayedTask( | 139 base::ThreadTaskRunnerHandle::Get()->PostDelayedTask( |
141 FROM_HERE, base::Bind(&ArcBridgeServiceImpl::PrerequisitesChanged, | 140 FROM_HERE, base::Bind(&ArcBridgeServiceImpl::PrerequisitesChanged, |
142 weak_factory_.GetWeakPtr()), | 141 weak_factory_.GetWeakPtr()), |
143 base::TimeDelta::FromSeconds(kReconnectDelayInSeconds)); | 142 base::TimeDelta::FromSeconds(kReconnectDelayInSeconds)); |
144 } else { | 143 } else { |
145 // Restart immediately. | 144 // Restart immediately. |
146 PrerequisitesChanged(); | 145 PrerequisitesChanged(); |
147 } | 146 } |
148 } | 147 } |
149 } | 148 } |
150 | 149 |
151 } // namespace arc | 150 } // namespace arc |
OLD | NEW |