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