| 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/net/view_http_cache_job_factory.h" | 5 #include "content/browser/net/view_http_cache_job_factory.h" |
| 6 | 6 |
| 7 #include "base/bind.h" | 7 #include "base/bind.h" |
| 8 #include "base/bind_helpers.h" | 8 #include "base/bind_helpers.h" |
| 9 #include "base/callback.h" | 9 #include "base/callback.h" |
| 10 #include "base/compiler_specific.h" | 10 #include "base/compiler_specific.h" |
| 11 #include "base/location.h" |
| 11 #include "base/memory/weak_ptr.h" | 12 #include "base/memory/weak_ptr.h" |
| 12 #include "base/message_loop/message_loop.h" | 13 #include "base/single_thread_task_runner.h" |
| 13 #include "base/strings/string_util.h" | 14 #include "base/strings/string_util.h" |
| 15 #include "base/thread_task_runner_handle.h" |
| 14 #include "content/public/common/url_constants.h" | 16 #include "content/public/common/url_constants.h" |
| 15 #include "net/base/completion_callback.h" | 17 #include "net/base/completion_callback.h" |
| 16 #include "net/base/net_errors.h" | 18 #include "net/base/net_errors.h" |
| 17 #include "net/url_request/url_request.h" | 19 #include "net/url_request/url_request.h" |
| 18 #include "net/url_request/url_request_simple_job.h" | 20 #include "net/url_request/url_request_simple_job.h" |
| 19 #include "net/url_request/view_cache_helper.h" | 21 #include "net/url_request/view_cache_helper.h" |
| 20 | 22 |
| 21 namespace content { | 23 namespace content { |
| 22 namespace { | 24 namespace { |
| 23 | 25 |
| (...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 89 | 91 |
| 90 scoped_refptr<Core> core_; | 92 scoped_refptr<Core> core_; |
| 91 base::Closure callback_; | 93 base::Closure callback_; |
| 92 | 94 |
| 93 base::WeakPtrFactory<ViewHttpCacheJob> weak_factory_; | 95 base::WeakPtrFactory<ViewHttpCacheJob> weak_factory_; |
| 94 | 96 |
| 95 DISALLOW_COPY_AND_ASSIGN(ViewHttpCacheJob); | 97 DISALLOW_COPY_AND_ASSIGN(ViewHttpCacheJob); |
| 96 }; | 98 }; |
| 97 | 99 |
| 98 void ViewHttpCacheJob::Start() { | 100 void ViewHttpCacheJob::Start() { |
| 99 base::MessageLoop::current()->PostTask( | 101 base::ThreadTaskRunnerHandle::Get()->PostTask( |
| 100 FROM_HERE, | 102 FROM_HERE, |
| 101 base::Bind(&ViewHttpCacheJob::StartAsync, weak_factory_.GetWeakPtr())); | 103 base::Bind(&ViewHttpCacheJob::StartAsync, weak_factory_.GetWeakPtr())); |
| 102 } | 104 } |
| 103 | 105 |
| 104 void ViewHttpCacheJob::Kill() { | 106 void ViewHttpCacheJob::Kill() { |
| 105 weak_factory_.InvalidateWeakPtrs(); | 107 weak_factory_.InvalidateWeakPtrs(); |
| 106 if (core_.get()) { | 108 if (core_.get()) { |
| 107 core_->Orphan(); | 109 core_->Orphan(); |
| 108 core_ = NULL; | 110 core_ = NULL; |
| 109 } | 111 } |
| (...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 194 url.host() == kChromeUINetworkViewCacheHost; | 196 url.host() == kChromeUINetworkViewCacheHost; |
| 195 } | 197 } |
| 196 | 198 |
| 197 // Static. | 199 // Static. |
| 198 net::URLRequestJob* ViewHttpCacheJobFactory::CreateJobForRequest( | 200 net::URLRequestJob* ViewHttpCacheJobFactory::CreateJobForRequest( |
| 199 net::URLRequest* request, net::NetworkDelegate* network_delegate) { | 201 net::URLRequest* request, net::NetworkDelegate* network_delegate) { |
| 200 return new ViewHttpCacheJob(request, network_delegate); | 202 return new ViewHttpCacheJob(request, network_delegate); |
| 201 } | 203 } |
| 202 | 204 |
| 203 } // namespace content | 205 } // namespace content |
| OLD | NEW |