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 #include "content/browser/fileapi/chrome_blob_storage_context.h" | 5 #include "content/browser/fileapi/chrome_blob_storage_context.h" |
6 | 6 |
7 #include "base/bind.h" | 7 #include "base/bind.h" |
| 8 #include "content/browser/streams/stream_registry.h" |
8 #include "content/public/browser/browser_context.h" | 9 #include "content/public/browser/browser_context.h" |
9 #include "content/public/browser/browser_thread.h" | 10 #include "content/public/browser/browser_thread.h" |
10 #include "webkit/browser/blob/blob_storage_controller.h" | 11 #include "webkit/browser/blob/blob_storage_controller.h" |
11 | 12 |
12 using base::UserDataAdapter; | 13 using base::UserDataAdapter; |
13 using webkit_blob::BlobStorageController; | 14 using webkit_blob::BlobStorageController; |
14 | 15 |
15 namespace content { | 16 namespace content { |
16 | 17 |
17 static const char* kBlobStorageContextKeyName = "content_blob_storage_context"; | 18 static const char* kBlobStorageContextKeyName = "content_blob_storage_context"; |
(...skipping 16 matching lines...) Expand all Loading... |
34 } | 35 } |
35 } | 36 } |
36 | 37 |
37 return UserDataAdapter<ChromeBlobStorageContext>::Get( | 38 return UserDataAdapter<ChromeBlobStorageContext>::Get( |
38 context, kBlobStorageContextKeyName); | 39 context, kBlobStorageContextKeyName); |
39 } | 40 } |
40 | 41 |
41 void ChromeBlobStorageContext::InitializeOnIOThread() { | 42 void ChromeBlobStorageContext::InitializeOnIOThread() { |
42 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); | 43 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); |
43 controller_.reset(new BlobStorageController()); | 44 controller_.reset(new BlobStorageController()); |
| 45 stream_registry_.reset(new StreamRegistry()); |
44 } | 46 } |
45 | 47 |
46 ChromeBlobStorageContext::~ChromeBlobStorageContext() {} | 48 ChromeBlobStorageContext::~ChromeBlobStorageContext() {} |
47 | 49 |
48 void ChromeBlobStorageContext::DeleteOnCorrectThread() const { | 50 void ChromeBlobStorageContext::DeleteOnCorrectThread() const { |
| 51 // In many tests, there isn't a valid IO thread. In that case, just delete on |
| 52 // the current thread. |
| 53 // TODO(tyoshino): Remove this custom deleter, and fix the leaks in all the |
| 54 // tests. |
49 if (BrowserThread::IsMessageLoopValid(BrowserThread::IO) && | 55 if (BrowserThread::IsMessageLoopValid(BrowserThread::IO) && |
50 !BrowserThread::CurrentlyOn(BrowserThread::IO)) { | 56 !BrowserThread::CurrentlyOn(BrowserThread::IO)) { |
51 BrowserThread::DeleteSoon(BrowserThread::IO, FROM_HERE, this); | 57 BrowserThread::DeleteSoon(BrowserThread::IO, FROM_HERE, this); |
52 return; | 58 return; |
53 } | 59 } |
54 delete this; | 60 delete this; |
55 } | 61 } |
56 | 62 |
57 } // namespace content | 63 } // namespace content |
OLD | NEW |