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

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

Issue 10068036: RefCounted types should not have public destructors, chrome/browser/ part 5 (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Win fix Created 8 years, 8 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 | 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 CHROME_BROWSER_PROFILES_REFCOUNTED_PROFILE_KEYED_SERVICE_H_ 5 #ifndef CHROME_BROWSER_PROFILES_REFCOUNTED_PROFILE_KEYED_SERVICE_H_
6 #define CHROME_BROWSER_PROFILES_REFCOUNTED_PROFILE_KEYED_SERVICE_H_ 6 #define CHROME_BROWSER_PROFILES_REFCOUNTED_PROFILE_KEYED_SERVICE_H_
7 7
8 #include "base/memory/ref_counted.h" 8 #include "base/memory/ref_counted.h"
9 #include "base/sequenced_task_runner_helpers.h"
9 #include "content/public/browser/browser_thread.h" 10 #include "content/public/browser/browser_thread.h"
10 11
11 class RefcountedProfileKeyedService; 12 class RefcountedProfileKeyedService;
12 13
13 namespace impl { 14 namespace impl {
14 15
15 struct RefcountedProfileKeyedServiceTraits { 16 struct RefcountedProfileKeyedServiceTraits {
16 static void Destruct(const RefcountedProfileKeyedService* obj); 17 static void Destruct(const RefcountedProfileKeyedService* obj);
17 }; 18 };
18 19
(...skipping 16 matching lines...) Expand all
35 RefcountedProfileKeyedService, 36 RefcountedProfileKeyedService,
36 impl::RefcountedProfileKeyedServiceTraits> { 37 impl::RefcountedProfileKeyedServiceTraits> {
37 public: 38 public:
38 // Unlike ProfileKeyedService, ShutdownOnUI is not optional. You must do 39 // Unlike ProfileKeyedService, ShutdownOnUI is not optional. You must do
39 // something to drop references during the first pass Shutdown() because this 40 // something to drop references during the first pass Shutdown() because this
40 // is the only point where you are guaranteed that something is running on 41 // is the only point where you are guaranteed that something is running on
41 // the UI thread. The PKSF framework will ensure that this is only called on 42 // the UI thread. The PKSF framework will ensure that this is only called on
42 // the UI thread; you do not need to check for that yourself. 43 // the UI thread; you do not need to check for that yourself.
43 virtual void ShutdownOnUIThread() = 0; 44 virtual void ShutdownOnUIThread() = 0;
44 45
45 // The second pass destruction can happen anywhere unless you specify which
46 // thread this service must be destroyed on by using the second constructor.
47 virtual ~RefcountedProfileKeyedService();
48
49 protected: 46 protected:
50 // If your service does not need to be deleted on a specific thread, use the 47 // If your service does not need to be deleted on a specific thread, use the
51 // default constructor. 48 // default constructor.
52 RefcountedProfileKeyedService(); 49 RefcountedProfileKeyedService();
53 50
54 // If you need your service to be deleted on a specific thread (for example, 51 // If you need your service to be deleted on a specific thread (for example,
55 // you're converting a service that used content::DeleteOnThread<IO>), then 52 // you're converting a service that used content::DeleteOnThread<IO>), then
56 // use this constructor with the ID of the thread. 53 // use this constructor with the ID of the thread.
57 explicit RefcountedProfileKeyedService( 54 explicit RefcountedProfileKeyedService(
58 const content::BrowserThread::ID thread_id); 55 const content::BrowserThread::ID thread_id);
59 56
57 // The second pass destruction can happen anywhere unless you specify which
58 // thread this service must be destroyed on by using the second constructor.
59 virtual ~RefcountedProfileKeyedService();
60
60 private: 61 private:
61 friend struct impl::RefcountedProfileKeyedServiceTraits; 62 friend struct impl::RefcountedProfileKeyedServiceTraits;
63 friend class base::DeleteHelper<RefcountedProfileKeyedService>;
62 64
63 // Do we have to delete this object on a specific thread? 65 // Do we have to delete this object on a specific thread?
64 bool requires_destruction_on_thread_; 66 bool requires_destruction_on_thread_;
65 content::BrowserThread::ID thread_id_; 67 content::BrowserThread::ID thread_id_;
66 }; 68 };
67 69
68 #endif // CHROME_BROWSER_PROFILES_REFCOUNTED_PROFILE_KEYED_SERVICE_H_ 70 #endif // CHROME_BROWSER_PROFILES_REFCOUNTED_PROFILE_KEYED_SERVICE_H_
OLDNEW
« no previous file with comments | « chrome/browser/profiles/profile_io_data.cc ('k') | chrome/browser/safe_browsing/client_side_detection_host_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698