OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 "chromeos/dbus/dbus_thread_manager.h" | 5 #include "chromeos/dbus/dbus_thread_manager.h" |
6 | 6 |
7 #include "base/command_line.h" | 7 #include "base/command_line.h" |
8 #include "base/sys_info.h" | 8 #include "base/sys_info.h" |
9 #include "base/threading/thread.h" | 9 #include "base/threading/thread.h" |
10 #include "chromeos/chromeos_switches.h" | 10 #include "chromeos/chromeos_switches.h" |
(...skipping 336 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
347 | 347 |
348 // static | 348 // static |
349 void DBusThreadManager::Initialize() { | 349 void DBusThreadManager::Initialize() { |
350 // If we initialize DBusThreadManager twice we may also be shutting it down | 350 // If we initialize DBusThreadManager twice we may also be shutting it down |
351 // early; do not allow that. | 351 // early; do not allow that. |
352 if (g_using_dbus_thread_manager_for_testing) | 352 if (g_using_dbus_thread_manager_for_testing) |
353 return; | 353 return; |
354 | 354 |
355 CHECK(!g_dbus_thread_manager); | 355 CHECK(!g_dbus_thread_manager); |
356 bool use_dbus_stub = !base::SysInfo::IsRunningOnChromeOS() || | 356 bool use_dbus_stub = !base::SysInfo::IsRunningOnChromeOS() || |
357 CommandLine::ForCurrentProcess()->HasSwitch( | 357 base::CommandLine::ForCurrentProcess()->HasSwitch( |
358 chromeos::switches::kDbusStub); | 358 chromeos::switches::kDbusStub); |
359 bool force_unstub_clients = CommandLine::ForCurrentProcess()->HasSwitch( | 359 bool force_unstub_clients = base::CommandLine::ForCurrentProcess()->HasSwitch( |
360 chromeos::switches::kDbusUnstubClients); | 360 chromeos::switches::kDbusUnstubClients); |
361 // Determine whether we use stub or real client implementations. | 361 // Determine whether we use stub or real client implementations. |
362 if (force_unstub_clients) { | 362 if (force_unstub_clients) { |
363 InitializeWithPartialStub( | 363 InitializeWithPartialStub( |
364 CommandLine::ForCurrentProcess()->GetSwitchValueASCII( | 364 base::CommandLine::ForCurrentProcess()->GetSwitchValueASCII( |
365 chromeos::switches::kDbusUnstubClients)); | 365 chromeos::switches::kDbusUnstubClients)); |
366 } else if (use_dbus_stub) { | 366 } else if (use_dbus_stub) { |
367 InitializeWithStubs(); | 367 InitializeWithStubs(); |
368 } else { | 368 } else { |
369 InitializeWithRealClients(); | 369 InitializeWithRealClients(); |
370 } | 370 } |
371 } | 371 } |
372 | 372 |
373 // static | 373 // static |
374 scoped_ptr<DBusThreadManagerSetter> DBusThreadManager::GetSetterForTesting() { | 374 scoped_ptr<DBusThreadManagerSetter> DBusThreadManager::GetSetterForTesting() { |
(...skipping 284 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
659 client.Pass(); | 659 client.Pass(); |
660 } | 660 } |
661 | 661 |
662 void DBusThreadManagerSetter::SetUpdateEngineClient( | 662 void DBusThreadManagerSetter::SetUpdateEngineClient( |
663 scoped_ptr<UpdateEngineClient> client) { | 663 scoped_ptr<UpdateEngineClient> client) { |
664 DBusThreadManager::Get()->client_bundle_->update_engine_client_ = | 664 DBusThreadManager::Get()->client_bundle_->update_engine_client_ = |
665 client.Pass(); | 665 client.Pass(); |
666 } | 666 } |
667 | 667 |
668 } // namespace chromeos | 668 } // namespace chromeos |
OLD | NEW |