| OLD | NEW |
| 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 #pragma once | 7 #pragma once |
| 8 | 8 |
| 9 #include "base/memory/ref_counted.h" | 9 #include "base/memory/ref_counted.h" |
| 10 #include "base/memory/scoped_ptr.h" | 10 #include "base/memory/scoped_ptr.h" |
| (...skipping 15 matching lines...) Expand all Loading... |
| 26 // There is an instance associated with each BrowserContext. There could be | 26 // There is an instance associated with each BrowserContext. There could be |
| 27 // multiple URLRequestContexts in the same browser context that refers to the | 27 // multiple URLRequestContexts in the same browser context that refers to the |
| 28 // same instance. | 28 // same instance. |
| 29 // | 29 // |
| 30 // All methods, except the ctor, are expected to be called on | 30 // All methods, except the ctor, are expected to be called on |
| 31 // the IO thread (unless specifically called out in doc comments). | 31 // the IO thread (unless specifically called out in doc comments). |
| 32 class CONTENT_EXPORT ChromeBlobStorageContext | 32 class CONTENT_EXPORT ChromeBlobStorageContext |
| 33 : public base::RefCountedThreadSafe< | 33 : public base::RefCountedThreadSafe< |
| 34 ChromeBlobStorageContext, ChromeBlobStorageContextDeleter> { | 34 ChromeBlobStorageContext, ChromeBlobStorageContextDeleter> { |
| 35 public: | 35 public: |
| 36 ChromeBlobStorageContext(); |
| 37 |
| 36 static ChromeBlobStorageContext* GetFor( | 38 static ChromeBlobStorageContext* GetFor( |
| 37 content::BrowserContext* browser_context); | 39 content::BrowserContext* browser_context); |
| 38 | 40 |
| 39 ChromeBlobStorageContext(); | |
| 40 virtual ~ChromeBlobStorageContext(); | |
| 41 | |
| 42 void InitializeOnIOThread(); | 41 void InitializeOnIOThread(); |
| 43 | 42 |
| 44 webkit_blob::BlobStorageController* controller() const { | 43 webkit_blob::BlobStorageController* controller() const { |
| 45 return controller_.get(); | 44 return controller_.get(); |
| 46 } | 45 } |
| 47 | 46 |
| 48 private: | 47 private: |
| 49 friend struct ChromeBlobStorageContextDeleter; | 48 friend struct ChromeBlobStorageContextDeleter; |
| 49 friend class base::DeleteHelper<ChromeBlobStorageContext>; |
| 50 |
| 51 virtual ~ChromeBlobStorageContext(); |
| 50 | 52 |
| 51 void DeleteOnCorrectThread() const; | 53 void DeleteOnCorrectThread() const; |
| 52 | 54 |
| 53 scoped_ptr<webkit_blob::BlobStorageController> controller_; | 55 scoped_ptr<webkit_blob::BlobStorageController> controller_; |
| 54 }; | 56 }; |
| 55 | 57 |
| 56 struct ChromeBlobStorageContextDeleter { | 58 struct ChromeBlobStorageContextDeleter { |
| 57 static void Destruct(const ChromeBlobStorageContext* context) { | 59 static void Destruct(const ChromeBlobStorageContext* context) { |
| 58 context->DeleteOnCorrectThread(); | 60 context->DeleteOnCorrectThread(); |
| 59 } | 61 } |
| 60 }; | 62 }; |
| 61 | 63 |
| 62 #endif // CONTENT_BROWSER_FILEAPI_CHROME_BLOB_STORAGE_CONTEXT_H_ | 64 #endif // CONTENT_BROWSER_FILEAPI_CHROME_BLOB_STORAGE_CONTEXT_H_ |
| OLD | NEW |