OLD | NEW |
| (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 CONTENT_BROWSER_IN_PROCESS_WEBKIT_INDEXED_DB_KEY_UTILITY_CLIENT_H_ | |
6 #define CONTENT_BROWSER_IN_PROCESS_WEBKIT_INDEXED_DB_KEY_UTILITY_CLIENT_H_ | |
7 | |
8 #include <vector> | |
9 | |
10 #include "base/memory/ref_counted.h" | |
11 #include "content/common/content_export.h" | |
12 | |
13 class KeyUtilityClientImpl; | |
14 | |
15 namespace base { | |
16 template <typename T> | |
17 struct DefaultLazyInstanceTraits; | |
18 } // namespace base | |
19 | |
20 namespace content { | |
21 class IndexedDBKey; | |
22 class IndexedDBKeyPath; | |
23 class SerializedScriptValue; | |
24 } | |
25 | |
26 // Class for obtaining IndexedDBKeys from the SerializedScriptValues given | |
27 // an IDBKeyPath. This class is a thin singleton wrapper around the | |
28 // KeyUtilityClientImpl, which does the real work. | |
29 class IndexedDBKeyUtilityClient { | |
30 public: | |
31 // Synchronously obtain the |keys| from |values| for the given |key_path|. | |
32 static void CreateIDBKeysFromSerializedValuesAndKeyPath( | |
33 const std::vector<content::SerializedScriptValue>& values, | |
34 const content::IndexedDBKeyPath& key_path, | |
35 std::vector<content::IndexedDBKey>* keys); | |
36 | |
37 // Synchronously inject |key| into |value| using |key_path|. Returns the new | |
38 // value. | |
39 static content::SerializedScriptValue InjectIDBKeyIntoSerializedValue( | |
40 const content::IndexedDBKey& key, | |
41 const content::SerializedScriptValue& value, | |
42 const content::IndexedDBKeyPath& key_path); | |
43 | |
44 // Shut down the underlying implementation. Must be called on the IO thread. | |
45 static void Shutdown(); | |
46 | |
47 private: | |
48 friend struct base::DefaultLazyInstanceTraits<IndexedDBKeyUtilityClient>; | |
49 IndexedDBKeyUtilityClient(); | |
50 ~IndexedDBKeyUtilityClient(); | |
51 | |
52 bool is_shutdown_; | |
53 | |
54 // The real client; laziliy instantiated. | |
55 scoped_refptr<KeyUtilityClientImpl> impl_; | |
56 }; | |
57 | |
58 #endif // CONTENT_BROWSER_IN_PROCESS_WEBKIT_INDEXED_DB_KEY_UTILITY_CLIENT_H_ | |
OLD | NEW |