Remove PlatformFile from profile_browsertest
[chromium-blink-merge.git] / content / browser / fileapi / chrome_blob_storage_context.h
blob641e235300629c6c214693f77c25801a75035b57
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.
5 #ifndef CONTENT_BROWSER_FILEAPI_CHROME_BLOB_STORAGE_CONTEXT_H_
6 #define CONTENT_BROWSER_FILEAPI_CHROME_BLOB_STORAGE_CONTEXT_H_
8 #include "base/memory/ref_counted.h"
9 #include "base/memory/scoped_ptr.h"
10 #include "base/sequenced_task_runner_helpers.h"
11 #include "content/common/content_export.h"
13 namespace webkit_blob {
14 class BlobStorageContext;
17 namespace content {
18 class BrowserContext;
19 struct ChromeBlobStorageContextDeleter;
21 // A context class that keeps track of BlobStorageController used by the chrome.
22 // There is an instance associated with each BrowserContext. There could be
23 // multiple URLRequestContexts in the same browser context that refers to the
24 // same instance.
26 // All methods, except the ctor, are expected to be called on
27 // the IO thread (unless specifically called out in doc comments).
28 class CONTENT_EXPORT ChromeBlobStorageContext
29 : public base::RefCountedThreadSafe<ChromeBlobStorageContext,
30 ChromeBlobStorageContextDeleter> {
31 public:
32 ChromeBlobStorageContext();
34 static ChromeBlobStorageContext* GetFor(
35 BrowserContext* browser_context);
37 void InitializeOnIOThread();
39 webkit_blob::BlobStorageContext* context() const {
40 return context_.get();
43 protected:
44 virtual ~ChromeBlobStorageContext();
46 private:
47 friend class base::DeleteHelper<ChromeBlobStorageContext>;
48 friend class base::RefCountedThreadSafe<ChromeBlobStorageContext,
49 ChromeBlobStorageContextDeleter>;
50 friend struct ChromeBlobStorageContextDeleter;
52 void DeleteOnCorrectThread() const;
54 scoped_ptr<webkit_blob::BlobStorageContext> context_;
57 struct ChromeBlobStorageContextDeleter {
58 static void Destruct(const ChromeBlobStorageContext* context) {
59 context->DeleteOnCorrectThread();
63 } // namespace content
65 #endif // CONTENT_BROWSER_FILEAPI_CHROME_BLOB_STORAGE_CONTEXT_H_