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

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

Issue 442383002: Move storage-related files from webkit/ to new top-level directory storage/ (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: . Created 6 years, 4 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 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 "base/memory/ref_counted.h" 8 #include "base/memory/ref_counted.h"
9 #include "base/memory/scoped_ptr.h" 9 #include "base/memory/scoped_ptr.h"
10 #include "base/sequenced_task_runner_helpers.h" 10 #include "base/sequenced_task_runner_helpers.h"
11 #include "content/common/content_export.h" 11 #include "content/common/content_export.h"
12 12
13 namespace webkit_blob { 13 namespace storage {
14 class BlobStorageContext; 14 class BlobStorageContext;
15 } 15 }
16 16
17 namespace content { 17 namespace content {
18 class BlobHandle; 18 class BlobHandle;
19 class BrowserContext; 19 class BrowserContext;
20 struct ChromeBlobStorageContextDeleter; 20 struct ChromeBlobStorageContextDeleter;
21 21
22 // A context class that keeps track of BlobStorageController used by the chrome. 22 // A context class that keeps track of BlobStorageController used by the chrome.
23 // There is an instance associated with each BrowserContext. There could be 23 // There is an instance associated with each BrowserContext. There could be
24 // multiple URLRequestContexts in the same browser context that refers to the 24 // multiple URLRequestContexts in the same browser context that refers to the
25 // same instance. 25 // same instance.
26 // 26 //
27 // All methods, except the ctor, are expected to be called on 27 // All methods, except the ctor, are expected to be called on
28 // the IO thread (unless specifically called out in doc comments). 28 // the IO thread (unless specifically called out in doc comments).
29 class CONTENT_EXPORT ChromeBlobStorageContext 29 class CONTENT_EXPORT ChromeBlobStorageContext
30 : public base::RefCountedThreadSafe<ChromeBlobStorageContext, 30 : public base::RefCountedThreadSafe<ChromeBlobStorageContext,
31 ChromeBlobStorageContextDeleter> { 31 ChromeBlobStorageContextDeleter> {
32 public: 32 public:
33 ChromeBlobStorageContext(); 33 ChromeBlobStorageContext();
34 34
35 static ChromeBlobStorageContext* GetFor( 35 static ChromeBlobStorageContext* GetFor(
36 BrowserContext* browser_context); 36 BrowserContext* browser_context);
37 37
38 void InitializeOnIOThread(); 38 void InitializeOnIOThread();
39 39
40 webkit_blob::BlobStorageContext* context() const { 40 storage::BlobStorageContext* context() const { return context_.get(); }
41 return context_.get();
42 }
43 41
44 // Returns a NULL scoped_ptr on failure. 42 // Returns a NULL scoped_ptr on failure.
45 scoped_ptr<BlobHandle> CreateMemoryBackedBlob(const char* data, 43 scoped_ptr<BlobHandle> CreateMemoryBackedBlob(const char* data,
46 size_t length); 44 size_t length);
47 45
48 protected: 46 protected:
49 virtual ~ChromeBlobStorageContext(); 47 virtual ~ChromeBlobStorageContext();
50 48
51 private: 49 private:
52 friend class base::DeleteHelper<ChromeBlobStorageContext>; 50 friend class base::DeleteHelper<ChromeBlobStorageContext>;
53 friend class base::RefCountedThreadSafe<ChromeBlobStorageContext, 51 friend class base::RefCountedThreadSafe<ChromeBlobStorageContext,
54 ChromeBlobStorageContextDeleter>; 52 ChromeBlobStorageContextDeleter>;
55 friend struct ChromeBlobStorageContextDeleter; 53 friend struct ChromeBlobStorageContextDeleter;
56 54
57 void DeleteOnCorrectThread() const; 55 void DeleteOnCorrectThread() const;
58 56
59 scoped_ptr<webkit_blob::BlobStorageContext> context_; 57 scoped_ptr<storage::BlobStorageContext> context_;
60 }; 58 };
61 59
62 struct ChromeBlobStorageContextDeleter { 60 struct ChromeBlobStorageContextDeleter {
63 static void Destruct(const ChromeBlobStorageContext* context) { 61 static void Destruct(const ChromeBlobStorageContext* context) {
64 context->DeleteOnCorrectThread(); 62 context->DeleteOnCorrectThread();
65 } 63 }
66 }; 64 };
67 65
68 } // namespace content 66 } // namespace content
69 67
70 #endif // CONTENT_BROWSER_FILEAPI_CHROME_BLOB_STORAGE_CONTEXT_H_ 68 #endif // CONTENT_BROWSER_FILEAPI_CHROME_BLOB_STORAGE_CONTEXT_H_
OLDNEW
« no previous file with comments | « content/browser/fileapi/browser_file_system_helper.cc ('k') | content/browser/fileapi/chrome_blob_storage_context.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698