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

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

Issue 11410019: ********** Chromium Blob hacking (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: Created 8 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 | 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 #include "content/public/browser/browser_thread.h" 12 #include "content/public/browser/browser_thread.h"
13 13
14 namespace webkit_blob { 14 namespace webkit_blob {
15 class BlobStorageController; 15 class BlobStorageContext;
16 } 16 }
17 17
18 namespace content { 18 namespace content {
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::BlobStorageController* controller() const { 40 webkit_blob::BlobStorageContext* context() const {
41 return controller_.get(); 41 return context_.get();
42 } 42 }
43 43
44 protected: 44 protected:
45 virtual ~ChromeBlobStorageContext(); 45 virtual ~ChromeBlobStorageContext();
46 46
47 private: 47 private:
48 friend class base::DeleteHelper<ChromeBlobStorageContext>; 48 friend class base::DeleteHelper<ChromeBlobStorageContext>;
49 friend class base::RefCountedThreadSafe<ChromeBlobStorageContext, 49 friend class base::RefCountedThreadSafe<ChromeBlobStorageContext,
50 ChromeBlobStorageContextDeleter>; 50 ChromeBlobStorageContextDeleter>;
51 friend struct ChromeBlobStorageContextDeleter; 51 friend struct ChromeBlobStorageContextDeleter;
52 52
53 void DeleteOnCorrectThread() const; 53 void DeleteOnCorrectThread() const;
54 54
55 scoped_ptr<webkit_blob::BlobStorageController> controller_; 55 scoped_ptr<webkit_blob::BlobStorageContext> context_;
56 }; 56 };
57 57
58 struct ChromeBlobStorageContextDeleter { 58 struct ChromeBlobStorageContextDeleter {
59 static void Destruct(const ChromeBlobStorageContext* context) { 59 static void Destruct(const ChromeBlobStorageContext* context) {
60 context->DeleteOnCorrectThread(); 60 context->DeleteOnCorrectThread();
61 } 61 }
62 }; 62 };
63 63
64 } // namespace content 64 } // namespace content
65 65
66 #endif // CONTENT_BROWSER_FILEAPI_CHROME_BLOB_STORAGE_CONTEXT_H_ 66 #endif // CONTENT_BROWSER_FILEAPI_CHROME_BLOB_STORAGE_CONTEXT_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698