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/resource_context_impl.h" | 5 #include "content/browser/resource_context_impl.h" |
6 | 6 |
7 #include <stdint.h> | 7 #include <stdint.h> |
8 | 8 |
| 9 #include "base/bind.h" |
9 #include "base/logging.h" | 10 #include "base/logging.h" |
10 #include "content/browser/fileapi/chrome_blob_storage_context.h" | 11 #include "content/browser/fileapi/chrome_blob_storage_context.h" |
11 #include "content/browser/loader/resource_dispatcher_host_impl.h" | 12 #include "content/browser/loader/resource_dispatcher_host_impl.h" |
12 #include "content/browser/loader/resource_request_info_impl.h" | 13 #include "content/browser/loader/resource_request_info_impl.h" |
13 #include "content/browser/streams/stream_context.h" | 14 #include "content/browser/streams/stream_context.h" |
14 #include "content/browser/webui/url_data_manager_backend.h" | 15 #include "content/browser/webui/url_data_manager_backend.h" |
15 #include "content/public/browser/browser_context.h" | 16 #include "content/public/browser/browser_context.h" |
16 #include "content/public/browser/browser_thread.h" | 17 #include "content/public/browser/browser_thread.h" |
17 #include "net/base/keygen_handler.h" | 18 #include "net/base/keygen_handler.h" |
18 #include "net/ssl/client_cert_store.h" | 19 #include "net/ssl/client_cert_store.h" |
(...skipping 11 matching lines...) Expand all Loading... |
30 | 31 |
31 // Used by the default implementation of GetMediaDeviceIDSalt, below. | 32 // Used by the default implementation of GetMediaDeviceIDSalt, below. |
32 std::string ReturnEmptySalt() { | 33 std::string ReturnEmptySalt() { |
33 return std::string(); | 34 return std::string(); |
34 } | 35 } |
35 | 36 |
36 } // namespace | 37 } // namespace |
37 | 38 |
38 | 39 |
39 ResourceContext::ResourceContext() { | 40 ResourceContext::ResourceContext() { |
40 if (ResourceDispatcherHostImpl::Get()) | 41 ResourceDispatcherHostImpl* rdhi = ResourceDispatcherHostImpl::Get(); |
41 ResourceDispatcherHostImpl::Get()->AddResourceContext(this); | 42 if (rdhi) { |
| 43 BrowserThread::PostTask( |
| 44 BrowserThread::IO, FROM_HERE, |
| 45 base::Bind(&ResourceDispatcherHostImpl::AddResourceContext, |
| 46 base::Unretained(rdhi), this)); |
| 47 } |
42 } | 48 } |
43 | 49 |
44 ResourceContext::~ResourceContext() { | 50 ResourceContext::~ResourceContext() { |
45 ResourceDispatcherHostImpl* rdhi = ResourceDispatcherHostImpl::Get(); | 51 ResourceDispatcherHostImpl* rdhi = ResourceDispatcherHostImpl::Get(); |
46 if (rdhi) { | 52 if (rdhi) { |
47 rdhi->CancelRequestsForContext(this); | 53 rdhi->CancelRequestsForContext(this); |
48 rdhi->RemoveResourceContext(this); | 54 rdhi->RemoveResourceContext(this); |
49 } | 55 } |
50 | 56 |
51 // In some tests this object is destructed on UI thread. | 57 // In some tests this object is destructed on UI thread. |
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
104 | 110 |
105 resource_context->SetUserData( | 111 resource_context->SetUserData( |
106 kStreamContextKeyName, | 112 kStreamContextKeyName, |
107 new UserDataAdapter<StreamContext>( | 113 new UserDataAdapter<StreamContext>( |
108 StreamContext::GetFor(browser_context))); | 114 StreamContext::GetFor(browser_context))); |
109 | 115 |
110 resource_context->DetachUserDataThread(); | 116 resource_context->DetachUserDataThread(); |
111 } | 117 } |
112 | 118 |
113 } // namespace content | 119 } // namespace content |
OLD | NEW |