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

Side by Side Diff: chrome/browser/profiles/profile_manager.h

Issue 2907253003: Replace deprecated base::NonThreadSafe in chrome/browser/profiles. (Closed)
Patch Set: Created 3 years, 6 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
« no previous file with comments | « no previous file | chrome/browser/profiles/profile_manager.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 // This class keeps track of the currently-active profiles in the runtime. 5 // This class keeps track of the currently-active profiles in the runtime.
6 6
7 #ifndef CHROME_BROWSER_PROFILES_PROFILE_MANAGER_H_ 7 #ifndef CHROME_BROWSER_PROFILES_PROFILE_MANAGER_H_
8 #define CHROME_BROWSER_PROFILES_PROFILE_MANAGER_H_ 8 #define CHROME_BROWSER_PROFILES_PROFILE_MANAGER_H_
9 9
10 #include <stddef.h> 10 #include <stddef.h>
11 11
12 #include <list> 12 #include <list>
13 #include <memory> 13 #include <memory>
14 #include <vector> 14 #include <vector>
15 15
16 #include "base/containers/hash_tables.h" 16 #include "base/containers/hash_tables.h"
17 #include "base/files/file_path.h" 17 #include "base/files/file_path.h"
18 #include "base/gtest_prod_util.h" 18 #include "base/gtest_prod_util.h"
19 #include "base/macros.h" 19 #include "base/macros.h"
20 #include "base/memory/linked_ptr.h" 20 #include "base/memory/linked_ptr.h"
21 #include "base/message_loop/message_loop.h" 21 #include "base/message_loop/message_loop.h"
22 #include "base/threading/non_thread_safe.h" 22 #include "base/sequence_checker.h"
23 #include "build/build_config.h" 23 #include "build/build_config.h"
24 #include "chrome/browser/profiles/profile.h" 24 #include "chrome/browser/profiles/profile.h"
25 #include "chrome/browser/profiles/profile_metrics.h" 25 #include "chrome/browser/profiles/profile_metrics.h"
26 #include "chrome/browser/profiles/profile_shortcut_manager.h" 26 #include "chrome/browser/profiles/profile_shortcut_manager.h"
27 #include "chrome/browser/ui/browser_list_observer.h" 27 #include "chrome/browser/ui/browser_list_observer.h"
28 #include "chrome/common/features.h" 28 #include "chrome/common/features.h"
29 #include "content/public/browser/notification_observer.h" 29 #include "content/public/browser/notification_observer.h"
30 #include "content/public/browser/notification_registrar.h" 30 #include "content/public/browser/notification_registrar.h"
31 31
32 class ProfileAttributesStorage; 32 class ProfileAttributesStorage;
33 class ProfileInfoCache; 33 class ProfileInfoCache;
34 34
35 class ProfileManager : public base::NonThreadSafe, 35 class ProfileManager : public content::NotificationObserver,
36 public content::NotificationObserver,
37 public Profile::Delegate { 36 public Profile::Delegate {
38 public: 37 public:
39 typedef base::Callback<void(Profile*, Profile::CreateStatus)> CreateCallback; 38 typedef base::Callback<void(Profile*, Profile::CreateStatus)> CreateCallback;
40 typedef base::Callback<void(Profile*)> ProfileLoadedCallback; 39 typedef base::Callback<void(Profile*)> ProfileLoadedCallback;
41 40
42 explicit ProfileManager(const base::FilePath& user_data_dir); 41 explicit ProfileManager(const base::FilePath& user_data_dir);
43 ~ProfileManager() override; 42 ~ProfileManager() override;
44 43
45 #if BUILDFLAG(ENABLE_SESSION_SERVICE) 44 #if BUILDFLAG(ENABLE_SESSION_SERVICE)
46 // Invokes SessionServiceFactory::ShutdownForProfile() for all profiles. 45 // Invokes SessionServiceFactory::ShutdownForProfile() for all profiles.
(...skipping 373 matching lines...) Expand 10 before | Expand all | Expand 10 after
420 // Manages the process of creating, deleteing and updating Desktop shortcuts. 419 // Manages the process of creating, deleteing and updating Desktop shortcuts.
421 std::unique_ptr<ProfileShortcutManager> profile_shortcut_manager_; 420 std::unique_ptr<ProfileShortcutManager> profile_shortcut_manager_;
422 421
423 // For keeping track of the last active profiles. 422 // For keeping track of the last active profiles.
424 std::map<Profile*, int> browser_counts_; 423 std::map<Profile*, int> browser_counts_;
425 // On startup we launch the active profiles in the order they became active 424 // On startup we launch the active profiles in the order they became active
426 // during the last run. This is why they are kept in a list, not in a set. 425 // during the last run. This is why they are kept in a list, not in a set.
427 std::vector<Profile*> active_profiles_; 426 std::vector<Profile*> active_profiles_;
428 bool closing_all_browsers_; 427 bool closing_all_browsers_;
429 428
429 SEQUENCE_CHECKER(sequence_checker_);
Bernhard Bauer 2017/05/31 13:19:52 I would get rid of this completely in favor of DCH
gab 2017/05/31 16:47:24 Done.
430
430 DISALLOW_COPY_AND_ASSIGN(ProfileManager); 431 DISALLOW_COPY_AND_ASSIGN(ProfileManager);
431 }; 432 };
432 433
433 // Same as the ProfileManager, but doesn't initialize some services of the 434 // Same as the ProfileManager, but doesn't initialize some services of the
434 // profile. This one is useful in unittests. 435 // profile. This one is useful in unittests.
435 class ProfileManagerWithoutInit : public ProfileManager { 436 class ProfileManagerWithoutInit : public ProfileManager {
436 public: 437 public:
437 explicit ProfileManagerWithoutInit(const base::FilePath& user_data_dir); 438 explicit ProfileManagerWithoutInit(const base::FilePath& user_data_dir);
438 439
439 protected: 440 protected:
440 void DoFinalInitForServices(Profile*, bool) override {} 441 void DoFinalInitForServices(Profile*, bool) override {}
441 void DoFinalInitLogging(Profile*) override {} 442 void DoFinalInitLogging(Profile*) override {}
442 }; 443 };
443 444
444 #endif // CHROME_BROWSER_PROFILES_PROFILE_MANAGER_H_ 445 #endif // CHROME_BROWSER_PROFILES_PROFILE_MANAGER_H_
OLDNEW
« no previous file with comments | « no previous file | chrome/browser/profiles/profile_manager.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698