1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. 2 // Use of this source code is governed by a BSD-style license that can be 3 // found in the LICENSE file. 4 5 #include "net/url_request/url_request_error_job.h" 6 7 #include "base/compiler_specific.h" 8 #include "base/message_loop.h" 9 #include "net/base/net_errors.h" 10 #include "net/url_request/url_request_status.h" 11 12 namespace net { 13 14 URLRequestErrorJob::URLRequestErrorJob(URLRequest* request, int error) 15 : URLRequestJob(request), 16 error_(error), 17 ALLOW_THIS_IN_INITIALIZER_LIST(method_factory_(this)) {} 18 19 URLRequestErrorJob::~URLRequestErrorJob() {} 20 21 void URLRequestErrorJob::Start() { 22 MessageLoop::current()->PostTask( 23 FROM_HERE, 24 method_factory_.NewRunnableMethod(&URLRequestErrorJob::StartAsync)); 25 } 26 27 void URLRequestErrorJob::StartAsync() { 28 NotifyStartError(URLRequestStatus(URLRequestStatus::FAILED, error_)); 29 } 30 31 } // namespace net 32