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 "chrome/browser/custom_handlers/protocol_handler_registry.h" | 5 #include "chrome/browser/custom_handlers/protocol_handler_registry.h" |
6 | 6 |
7 #include <stddef.h> | 7 #include <stddef.h> |
8 | 8 |
9 #include <memory> | 9 #include <memory> |
10 #include <utility> | 10 #include <utility> |
(...skipping 151 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
162 // JobInterceptorFactory ------------------------------------------------------- | 162 // JobInterceptorFactory ------------------------------------------------------- |
163 | 163 |
164 // Instances of JobInterceptorFactory are produced for ownership by the IO | 164 // Instances of JobInterceptorFactory are produced for ownership by the IO |
165 // thread where it handler URL requests. We should never hold | 165 // thread where it handler URL requests. We should never hold |
166 // any pointers on this class, only produce them in response to | 166 // any pointers on this class, only produce them in response to |
167 // requests via |ProtocolHandlerRegistry::CreateJobInterceptorFactory|. | 167 // requests via |ProtocolHandlerRegistry::CreateJobInterceptorFactory|. |
168 ProtocolHandlerRegistry::JobInterceptorFactory::JobInterceptorFactory( | 168 ProtocolHandlerRegistry::JobInterceptorFactory::JobInterceptorFactory( |
169 IOThreadDelegate* io_thread_delegate) | 169 IOThreadDelegate* io_thread_delegate) |
170 : io_thread_delegate_(io_thread_delegate) { | 170 : io_thread_delegate_(io_thread_delegate) { |
171 DCHECK(io_thread_delegate_.get()); | 171 DCHECK(io_thread_delegate_.get()); |
172 DetachFromThread(); | 172 DETACH_FROM_THREAD(thread_checker_); |
173 } | 173 } |
174 | 174 |
175 ProtocolHandlerRegistry::JobInterceptorFactory::~JobInterceptorFactory() { | 175 ProtocolHandlerRegistry::JobInterceptorFactory::~JobInterceptorFactory() { |
176 } | 176 } |
177 | 177 |
178 void ProtocolHandlerRegistry::JobInterceptorFactory::Chain( | 178 void ProtocolHandlerRegistry::JobInterceptorFactory::Chain( |
179 std::unique_ptr<net::URLRequestJobFactory> job_factory) { | 179 std::unique_ptr<net::URLRequestJobFactory> job_factory) { |
180 job_factory_ = std::move(job_factory); | 180 job_factory_ = std::move(job_factory); |
181 } | 181 } |
182 | 182 |
(...skipping 719 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
902 | 902 |
903 std::unique_ptr<ProtocolHandlerRegistry::JobInterceptorFactory> | 903 std::unique_ptr<ProtocolHandlerRegistry::JobInterceptorFactory> |
904 ProtocolHandlerRegistry::CreateJobInterceptorFactory() { | 904 ProtocolHandlerRegistry::CreateJobInterceptorFactory() { |
905 DCHECK_CURRENTLY_ON(BrowserThread::UI); | 905 DCHECK_CURRENTLY_ON(BrowserThread::UI); |
906 // this is always created on the UI thread (in profile_io's | 906 // this is always created on the UI thread (in profile_io's |
907 // InitializeOnUIThread. Any method calls must be done | 907 // InitializeOnUIThread. Any method calls must be done |
908 // on the IO thread (this is checked). | 908 // on the IO thread (this is checked). |
909 return std::unique_ptr<JobInterceptorFactory>( | 909 return std::unique_ptr<JobInterceptorFactory>( |
910 new JobInterceptorFactory(io_thread_delegate_.get())); | 910 new JobInterceptorFactory(io_thread_delegate_.get())); |
911 } | 911 } |
OLD | NEW |