Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(52)

Side by Side Diff: chromeos/dbus/dbus_thread_manager.cc

Issue 919183002: Move chromeos::device_event_log into components. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Move device_event_log::Initialize call to BrowserProcessImpl. Created 5 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
43 #include "chromeos/dbus/session_manager_client.h" 43 #include "chromeos/dbus/session_manager_client.h"
44 #include "chromeos/dbus/shill_device_client.h" 44 #include "chromeos/dbus/shill_device_client.h"
45 #include "chromeos/dbus/shill_ipconfig_client.h" 45 #include "chromeos/dbus/shill_ipconfig_client.h"
46 #include "chromeos/dbus/shill_manager_client.h" 46 #include "chromeos/dbus/shill_manager_client.h"
47 #include "chromeos/dbus/shill_profile_client.h" 47 #include "chromeos/dbus/shill_profile_client.h"
48 #include "chromeos/dbus/shill_service_client.h" 48 #include "chromeos/dbus/shill_service_client.h"
49 #include "chromeos/dbus/shill_third_party_vpn_driver_client.h" 49 #include "chromeos/dbus/shill_third_party_vpn_driver_client.h"
50 #include "chromeos/dbus/sms_client.h" 50 #include "chromeos/dbus/sms_client.h"
51 #include "chromeos/dbus/system_clock_client.h" 51 #include "chromeos/dbus/system_clock_client.h"
52 #include "chromeos/dbus/update_engine_client.h" 52 #include "chromeos/dbus/update_engine_client.h"
53 #include "chromeos/device_event_log.h" 53 #include "components/device_event_log/device_event_log.h"
stevenjb 2015/02/17 19:24:35 We shouldn't need this now.
Reilly Grant (use Gerrit) 2015/02/17 21:13:46 Done.
54 #include "dbus/bus.h" 54 #include "dbus/bus.h"
55 #include "dbus/dbus_statistics.h" 55 #include "dbus/dbus_statistics.h"
56 56
57 namespace chromeos { 57 namespace chromeos {
58 58
59 static DBusThreadManager* g_dbus_thread_manager = NULL; 59 static DBusThreadManager* g_dbus_thread_manager = NULL;
60 static bool g_using_dbus_thread_manager_for_testing = false; 60 static bool g_using_dbus_thread_manager_for_testing = false;
61 61
62 DBusThreadManager::DBusThreadManager(scoped_ptr<DBusClientBundle> client_bundle) 62 DBusThreadManager::DBusThreadManager(scoped_ptr<DBusClientBundle> client_bundle)
63 : client_bundle_(client_bundle.Pass()) { 63 : client_bundle_(client_bundle.Pass()) {
64 device_event_log::Initialize(0 /* default max entries */);
65 dbus::statistics::Initialize(); 64 dbus::statistics::Initialize();
66 65
67 if (client_bundle_->IsUsingAnyRealClient()) { 66 if (client_bundle_->IsUsingAnyRealClient()) {
68 // At least one real DBusClient is used. 67 // At least one real DBusClient is used.
69 // Create the D-Bus thread. 68 // Create the D-Bus thread.
70 base::Thread::Options thread_options; 69 base::Thread::Options thread_options;
71 thread_options.message_loop_type = base::MessageLoop::TYPE_IO; 70 thread_options.message_loop_type = base::MessageLoop::TYPE_IO;
72 dbus_thread_.reset(new base::Thread("D-Bus thread")); 71 dbus_thread_.reset(new base::Thread("D-Bus thread"));
73 dbus_thread_->StartWithOptions(thread_options); 72 dbus_thread_->StartWithOptions(thread_options);
74 73
(...skipping 13 matching lines...) Expand all
88 // Shut down the bus. During the browser shutdown, it's ok to shut down 87 // Shut down the bus. During the browser shutdown, it's ok to shut down
89 // the bus synchronously. 88 // the bus synchronously.
90 if (system_bus_.get()) 89 if (system_bus_.get())
91 system_bus_->ShutdownOnDBusThreadAndBlock(); 90 system_bus_->ShutdownOnDBusThreadAndBlock();
92 91
93 // Stop the D-Bus thread. 92 // Stop the D-Bus thread.
94 if (dbus_thread_) 93 if (dbus_thread_)
95 dbus_thread_->Stop(); 94 dbus_thread_->Stop();
96 95
97 dbus::statistics::Shutdown(); 96 dbus::statistics::Shutdown();
98 device_event_log::Shutdown(); 97 device_event_log::Shutdown();
stevenjb 2015/02/17 19:24:35 This needs to move also.
Reilly Grant (use Gerrit) 2015/02/17 21:13:46 Done.
99 98
100 if (!g_dbus_thread_manager) 99 if (!g_dbus_thread_manager)
101 return; // Called form Shutdown() or local test instance. 100 return; // Called form Shutdown() or local test instance.
102 101
103 // There should never be both a global instance and a local instance. 102 // There should never be both a global instance and a local instance.
104 CHECK(this == g_dbus_thread_manager); 103 CHECK(this == g_dbus_thread_manager);
105 if (g_using_dbus_thread_manager_for_testing) { 104 if (g_using_dbus_thread_manager_for_testing) {
106 g_dbus_thread_manager = NULL; 105 g_dbus_thread_manager = NULL;
107 g_using_dbus_thread_manager_for_testing = false; 106 g_using_dbus_thread_manager_for_testing = false;
108 VLOG(1) << "DBusThreadManager destroyed"; 107 VLOG(1) << "DBusThreadManager destroyed";
(...skipping 551 matching lines...) Expand 10 before | Expand all | Expand 10 after
660 client.Pass(); 659 client.Pass();
661 } 660 }
662 661
663 void DBusThreadManagerSetter::SetUpdateEngineClient( 662 void DBusThreadManagerSetter::SetUpdateEngineClient(
664 scoped_ptr<UpdateEngineClient> client) { 663 scoped_ptr<UpdateEngineClient> client) {
665 DBusThreadManager::Get()->client_bundle_->update_engine_client_ = 664 DBusThreadManager::Get()->client_bundle_->update_engine_client_ =
666 client.Pass(); 665 client.Pass();
667 } 666 }
668 667
669 } // namespace chromeos 668 } // namespace chromeos
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698