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

Side by Side Diff: chrome/browser/appcache/chrome_appcache_service.h

Issue 6077005: Refactored app cache clear on exit code to happen in the object owning the files. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fixed multithreading and added unit tests. Created 9 years, 11 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) 2010 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2010 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_APPCACHE_CHROME_APPCACHE_SERVICE_H_ 5 #ifndef CHROME_BROWSER_APPCACHE_CHROME_APPCACHE_SERVICE_H_
6 #define CHROME_BROWSER_APPCACHE_CHROME_APPCACHE_SERVICE_H_ 6 #define CHROME_BROWSER_APPCACHE_CHROME_APPCACHE_SERVICE_H_
7 #pragma once 7 #pragma once
8 8
9 #include "base/ref_counted.h" 9 #include "base/ref_counted.h"
10 #include "chrome/browser/browser_thread.h" 10 #include "chrome/browser/browser_thread.h"
(...skipping 17 matching lines...) Expand all
28 : public base::RefCountedThreadSafe<ChromeAppCacheService, 28 : public base::RefCountedThreadSafe<ChromeAppCacheService,
29 BrowserThread::DeleteOnIOThread>, 29 BrowserThread::DeleteOnIOThread>,
30 public appcache::AppCacheService, 30 public appcache::AppCacheService,
31 public appcache::AppCachePolicy, 31 public appcache::AppCachePolicy,
32 public NotificationObserver { 32 public NotificationObserver {
33 public: 33 public:
34 ChromeAppCacheService(); 34 ChromeAppCacheService();
35 35
36 void InitializeOnIOThread( 36 void InitializeOnIOThread(
37 const FilePath& profile_path, bool is_incognito, 37 const FilePath& profile_path, bool is_incognito,
38 scoped_refptr<HostContentSettingsMap> content_settings_map); 38 scoped_refptr<HostContentSettingsMap> content_settings_map,
39 bool clear_local_state_on_exit);
39 40
40 // Helpers used by the extension service to grant and revoke 41 // Helpers used by the extension service to grant and revoke
41 // unlimited storage to app extensions. 42 // unlimited storage to app extensions.
42 void SetOriginQuotaInMemory(const GURL& origin, int64 quota); 43 void SetOriginQuotaInMemory(const GURL& origin, int64 quota);
43 void ResetOriginQuotaInMemory(const GURL& origin); 44 void ResetOriginQuotaInMemory(const GURL& origin);
44 45
45 static void ClearLocalState(const FilePath& profile_path); 46 void SetClearLocalStateOnExit(bool clear_local_state);
46 47
47 private: 48 private:
48 friend class BrowserThread; 49 friend class BrowserThread;
49 friend class DeleteTask<ChromeAppCacheService>; 50 friend class DeleteTask<ChromeAppCacheService>;
50 51
51 virtual ~ChromeAppCacheService(); 52 virtual ~ChromeAppCacheService();
52 53
53 // AppCachePolicy overrides 54 // AppCachePolicy overrides
54 virtual bool CanLoadAppCache(const GURL& manifest_url); 55 virtual bool CanLoadAppCache(const GURL& manifest_url);
55 virtual int CanCreateAppCache(const GURL& manifest_url, 56 virtual int CanCreateAppCache(const GURL& manifest_url,
56 net::CompletionCallback* callback); 57 net::CompletionCallback* callback);
57 58
58 // NotificationObserver override 59 // NotificationObserver override
59 virtual void Observe(NotificationType type, 60 virtual void Observe(NotificationType type,
60 const NotificationSource& source, 61 const NotificationSource& source,
61 const NotificationDetails& details); 62 const NotificationDetails& details);
62 63
63 scoped_refptr<HostContentSettingsMap> host_contents_settings_map_; 64 scoped_refptr<HostContentSettingsMap> host_contents_settings_map_;
64 NotificationRegistrar registrar_; 65 NotificationRegistrar registrar_;
66 // Protects the |clear_local_state_on_exit_| flag.
67 Lock lock_;
68 bool clear_local_state_on_exit_;
69 FilePath cache_path_;
65 }; 70 };
66 71
67 #endif // CHROME_BROWSER_APPCACHE_CHROME_APPCACHE_SERVICE_H_ 72 #endif // CHROME_BROWSER_APPCACHE_CHROME_APPCACHE_SERVICE_H_
OLDNEW
« no previous file with comments | « no previous file | chrome/browser/appcache/chrome_appcache_service.cc » ('j') | chrome/browser/appcache/chrome_appcache_service.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698