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

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

Issue 83633004: Do not spawn a thread in browser/interactive ui tests before spawning sandbox host process (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years 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 | Annotate | Revision Log
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 #ifndef CHROMEOS_DBUS_DBUS_THREAD_MANAGER_H_ 5 #ifndef CHROMEOS_DBUS_DBUS_THREAD_MANAGER_H_
6 #define CHROMEOS_DBUS_DBUS_THREAD_MANAGER_H_ 6 #define CHROMEOS_DBUS_DBUS_THREAD_MANAGER_H_
7 7
8 #include <string> 8 #include <string>
9 9
10 #include "base/callback.h" 10 #include "base/callback.h"
(...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after
76 // WeakPtrFactory when creating callbacks that run on UI thread. See 76 // WeakPtrFactory when creating callbacks that run on UI thread. See
77 // session_manager_client.cc for examples. 77 // session_manager_client.cc for examples.
78 // 78 //
79 class CHROMEOS_EXPORT DBusThreadManager { 79 class CHROMEOS_EXPORT DBusThreadManager {
80 public: 80 public:
81 // Sets the global instance. Must be called before any calls to Get(). 81 // Sets the global instance. Must be called before any calls to Get().
82 // We explicitly initialize and shut down the global object, rather than 82 // We explicitly initialize and shut down the global object, rather than
83 // making it a Singleton, to ensure clean startup and shutdown. 83 // making it a Singleton, to ensure clean startup and shutdown.
84 static void Initialize(); 84 static void Initialize();
85 85
86 // Similar to Initialize(), but can inject an alternative 86 // Sets an alternative DBusThreadManager such as MockDBusThreadManager
87 // DBusThreadManager such as MockDBusThreadManager for testing. 87 // to be used in |Initialize()| for testing.
88 // The injected object will be owned by the internal pointer and deleted 88 // The injected object will be owned by the internal pointer and deleted
89 // by Shutdown(). 89 // by Shutdown().
90 static void SetInstanceForTesting(DBusThreadManager* dbus_thread_manager);
satorux1 2013/11/26 01:22:58 It wasn't clear to me why this needed to be introd
oshima 2013/11/26 02:18:43 This should be used in the test that creates a bro
satorux1 2013/11/26 06:52:07 Please add the explanation in the comment.
oshima 2013/11/26 20:46:44 Done.
91
92 // Similar to Initialize(), but injects an alternative
93 // DBusThreadManager using SetInstanceForTest first.
satorux1 2013/11/26 01:22:58 maybe add: // The injected object will be owned b
oshima 2013/11/26 02:18:43 Do you want to switch to use scoped_ptr instead? I
satorux1 2013/11/26 06:52:07 Let's keep it as-is for now.
oshima 2013/11/26 20:46:44 Done.
90 static void InitializeForTesting(DBusThreadManager* dbus_thread_manager); 94 static void InitializeForTesting(DBusThreadManager* dbus_thread_manager);
91 95
92 // Initialize with stub implementations for tests based on stubs. 96 // Initialize with stub implementations for tests based on stubs.
93 static void InitializeWithStub(); 97 static void InitializeWithStub();
94 98
95 // Returns true if DBusThreadManager has been initialized. Call this to 99 // Returns true if DBusThreadManager has been initialized. Call this to
96 // avoid initializing + shutting down DBusThreadManager more than once. 100 // avoid initializing + shutting down DBusThreadManager more than once.
97 static bool IsInitialized(); 101 static bool IsInitialized();
98 102
99 // Destroys the global instance. 103 // Destroys the global instance.
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after
155 159
156 // Initializes |client| with the |system_bus_|. 160 // Initializes |client| with the |system_bus_|.
157 static void InitClient(DBusClient* client); 161 static void InitClient(DBusClient* client);
158 162
159 DISALLOW_COPY_AND_ASSIGN(DBusThreadManager); 163 DISALLOW_COPY_AND_ASSIGN(DBusThreadManager);
160 }; 164 };
161 165
162 } // namespace chromeos 166 } // namespace chromeos
163 167
164 #endif // CHROMEOS_DBUS_DBUS_THREAD_MANAGER_H_ 168 #endif // CHROMEOS_DBUS_DBUS_THREAD_MANAGER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698