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

Side by Side Diff: chrome/browser/extensions/settings/value_store_cache.h

Issue 11747025: Run the JSON Schema Compiler's bundle compilation on JSON files. Previously it (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: fix ms release build Created 7 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
(Empty)
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
3 // found in the LICENSE file.
4
5 #ifndef CHROME_BROWSER_EXTENSIONS_SETTINGS_VALUE_STORE_CACHE_H_
6 #define CHROME_BROWSER_EXTENSIONS_SETTINGS_VALUE_STORE_CACHE_H_
7
8 #include <string>
9
10 #include "base/callback.h"
11 #include "base/memory/ref_counted.h"
12
13 class ValueStore;
14
15 namespace extensions {
16
17 class Extension;
18
19 // Each namespace of the storage API implements this interface.
20 // Instances are created on the UI thread, but from then on live on the FILE
21 // thread. At shutdown, ShutdownOnUI() is first invoked on the UI thread, and
22 // the destructor is invoked soon after on the FILE thread. This gives
23 // implementations the chance to work with ValueStores on FILE but observe
24 // events on UI.
25 // It also means that any methods invoked on UI *before ShutdownOnUI()* can
26 // safely post other methods to the FILE thread, since the deletion task is only
27 // posted to FILE after ShutdownOnUI().
28 class ValueStoreCache {
29 public:
30 typedef base::Callback<void(ValueStore*)> StorageCallback;
31
32 // Invoked on FILE.
33 virtual ~ValueStoreCache();
34
35 // This is invoked from the UI thread during destruction of the Profile that
36 // ultimately owns this object. Any Profile-related cleanups should be
37 // performed in this method, since the destructor will execute later, after
38 // the Profile is already gone.
39 virtual void ShutdownOnUI();
40
41 // Requests the cache to invoke |callback| with the appropriate ValueStore
42 // for the given |extension|. |callback| should be invoked with a NULL
43 // ValueStore in case of errors.
44 // |extension| is passed in a scoped_refptr<> because this method is
45 // asynchronously posted as a task to the loop returned by GetMessageLoop(),
46 // and this guarantees the Extension is still valid when the method executes.
47 virtual void RunWithValueStoreForExtension(
48 const StorageCallback& callback,
49 scoped_refptr<const Extension> extension) = 0;
50
51 // Requests the cache to delete any storage used by |extension_id|.
52 virtual void DeleteStorageSoon(const std::string& extension_id) = 0;
53 };
54
55 } // namespace extensions
56
57 #endif // CHROME_BROWSER_EXTENSIONS_SETTINGS_VALUE_STORE_CACHE_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698