| 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 "net/url_request/url_request_error_job.h" | 5 #include "net/url_request/url_request_error_job.h" |
| 6 | 6 |
| 7 #include "base/bind.h" | 7 #include "base/bind.h" |
| 8 #include "base/compiler_specific.h" | 8 #include "base/compiler_specific.h" |
| 9 #include "base/message_loop/message_loop.h" | 9 #include "base/message_loop/message_loop.h" |
| 10 #include "net/base/net_errors.h" | 10 #include "net/base/net_errors.h" |
| 11 #include "net/url_request/url_request_status.h" | 11 #include "net/url_request/url_request_status.h" |
| 12 | 12 |
| 13 namespace net { | 13 namespace net { |
| 14 | 14 |
| 15 URLRequestErrorJob::URLRequestErrorJob( | 15 URLRequestErrorJob::URLRequestErrorJob(URLRequest* request, |
| 16 URLRequest* request, NetworkDelegate* network_delegate, int error) | 16 NetworkDelegate* network_delegate, |
| 17 int error) |
| 17 : URLRequestJob(request, network_delegate), | 18 : URLRequestJob(request, network_delegate), |
| 18 error_(error), | 19 error_(error), |
| 19 weak_factory_(this) {} | 20 weak_factory_(this) { |
| 21 } |
| 20 | 22 |
| 21 URLRequestErrorJob::~URLRequestErrorJob() {} | 23 URLRequestErrorJob::~URLRequestErrorJob() { |
| 24 } |
| 22 | 25 |
| 23 void URLRequestErrorJob::Start() { | 26 void URLRequestErrorJob::Start() { |
| 24 base::MessageLoop::current()->PostTask( | 27 base::MessageLoop::current()->PostTask( |
| 25 FROM_HERE, | 28 FROM_HERE, |
| 26 base::Bind(&URLRequestErrorJob::StartAsync, weak_factory_.GetWeakPtr())); | 29 base::Bind(&URLRequestErrorJob::StartAsync, weak_factory_.GetWeakPtr())); |
| 27 } | 30 } |
| 28 | 31 |
| 29 void URLRequestErrorJob::StartAsync() { | 32 void URLRequestErrorJob::StartAsync() { |
| 30 NotifyStartError(URLRequestStatus(URLRequestStatus::FAILED, error_)); | 33 NotifyStartError(URLRequestStatus(URLRequestStatus::FAILED, error_)); |
| 31 } | 34 } |
| 32 | 35 |
| 33 } // namespace net | 36 } // namespace net |
| OLD | NEW |