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

Side by Side Diff: content/browser/blob_storage/chrome_blob_storage_context.h

Issue 2550113003: Revert of [BlobStorage] Implementing disk. (Closed)
Patch Set: Created 4 years 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
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 CONTENT_BROWSER_FILEAPI_CHROME_BLOB_STORAGE_CONTEXT_H_ 5 #ifndef CONTENT_BROWSER_FILEAPI_CHROME_BLOB_STORAGE_CONTEXT_H_
6 #define CONTENT_BROWSER_FILEAPI_CHROME_BLOB_STORAGE_CONTEXT_H_ 6 #define CONTENT_BROWSER_FILEAPI_CHROME_BLOB_STORAGE_CONTEXT_H_
7 7
8 #include <stddef.h> 8 #include <stddef.h>
9 #include <stdint.h> 9 #include <stdint.h>
10 10
11 #include <memory> 11 #include <memory>
12 12
13 #include "base/files/file_path.h"
14 #include "base/memory/ref_counted.h" 13 #include "base/memory/ref_counted.h"
15 #include "base/sequenced_task_runner_helpers.h" 14 #include "base/sequenced_task_runner_helpers.h"
16 #include "content/common/content_export.h" 15 #include "content/common/content_export.h"
17 16
18 namespace base { 17 namespace base {
19 class FilePath; 18 class FilePath;
20 class TaskRunner;
21 class Time; 19 class Time;
22 } 20 }
23 21
24 namespace storage { 22 namespace storage {
25 class BlobStorageContext; 23 class BlobStorageContext;
26 } 24 }
27 25
28 namespace content { 26 namespace content {
29 class BlobHandle; 27 class BlobHandle;
30 class BrowserContext; 28 class BrowserContext;
31 struct ChromeBlobStorageContextDeleter; 29 struct ChromeBlobStorageContextDeleter;
32 30
33 // A context class that keeps track of BlobStorageController used by the chrome. 31 // A context class that keeps track of BlobStorageController used by the chrome.
34 // There is an instance associated with each BrowserContext. There could be 32 // There is an instance associated with each BrowserContext. There could be
35 // multiple URLRequestContexts in the same browser context that refers to the 33 // multiple URLRequestContexts in the same browser context that refers to the
36 // same instance. 34 // same instance.
37 // 35 //
38 // All methods, except the ctor, are expected to be called on 36 // All methods, except the ctor, are expected to be called on
39 // the IO thread (unless specifically called out in doc comments). 37 // the IO thread (unless specifically called out in doc comments).
40 class CONTENT_EXPORT ChromeBlobStorageContext 38 class CONTENT_EXPORT ChromeBlobStorageContext
41 : public base::RefCountedThreadSafe<ChromeBlobStorageContext, 39 : public base::RefCountedThreadSafe<ChromeBlobStorageContext,
42 ChromeBlobStorageContextDeleter> { 40 ChromeBlobStorageContextDeleter> {
43 public: 41 public:
44 ChromeBlobStorageContext(); 42 ChromeBlobStorageContext();
45 43
46 static ChromeBlobStorageContext* GetFor( 44 static ChromeBlobStorageContext* GetFor(
47 BrowserContext* browser_context); 45 BrowserContext* browser_context);
48 46
49 void InitializeOnIOThread(base::FilePath blob_storage_dir, 47 void InitializeOnIOThread();
50 scoped_refptr<base::TaskRunner> file_task_runner);
51 48
52 storage::BlobStorageContext* context() const { return context_.get(); } 49 storage::BlobStorageContext* context() const { return context_.get(); }
53 50
54 // Returns a NULL scoped_ptr on failure. 51 // Returns a NULL scoped_ptr on failure.
55 std::unique_ptr<BlobHandle> CreateMemoryBackedBlob(const char* data, 52 std::unique_ptr<BlobHandle> CreateMemoryBackedBlob(const char* data,
56 size_t length); 53 size_t length);
57 54
58 // Returns a NULL scoped_ptr on failure. 55 // Returns a NULL scoped_ptr on failure.
59 std::unique_ptr<BlobHandle> CreateFileBackedBlob( 56 std::unique_ptr<BlobHandle> CreateFileBackedBlob(
60 const base::FilePath& path, 57 const base::FilePath& path,
(...skipping 17 matching lines...) Expand all
78 75
79 struct ChromeBlobStorageContextDeleter { 76 struct ChromeBlobStorageContextDeleter {
80 static void Destruct(const ChromeBlobStorageContext* context) { 77 static void Destruct(const ChromeBlobStorageContext* context) {
81 context->DeleteOnCorrectThread(); 78 context->DeleteOnCorrectThread();
82 } 79 }
83 }; 80 };
84 81
85 } // namespace content 82 } // namespace content
86 83
87 #endif // CONTENT_BROWSER_FILEAPI_CHROME_BLOB_STORAGE_CONTEXT_H_ 84 #endif // CONTENT_BROWSER_FILEAPI_CHROME_BLOB_STORAGE_CONTEXT_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698