Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1061)

Side by Side Diff: net/url_request/url_request_error_job.cc

Issue 10534100: Decouple URLRequestJob from URLRequestContext; access NetworkDelegate as a contructor parameter. (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: Created 8 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. 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 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.h" 9 #include "base/message_loop.h"
10 #include "net/base/net_errors.h" 10 #include "net/base/net_errors.h"
11 #include "net/url_request/url_request.h"
12 #include "net/url_request/url_request_context.h"
11 #include "net/url_request/url_request_status.h" 13 #include "net/url_request/url_request_status.h"
12 14
13 namespace net { 15 namespace net {
14 16
15 URLRequestErrorJob::URLRequestErrorJob(URLRequest* request, int error) 17 URLRequestErrorJob::URLRequestErrorJob(URLRequest* request, int error)
16 : URLRequestJob(request), 18 : URLRequestJob(request, request->context()->network_delegate()),
17 error_(error), 19 error_(error),
18 ALLOW_THIS_IN_INITIALIZER_LIST(weak_factory_(this)) {} 20 ALLOW_THIS_IN_INITIALIZER_LIST(weak_factory_(this)) {}
19 21
20 URLRequestErrorJob::~URLRequestErrorJob() {} 22 URLRequestErrorJob::~URLRequestErrorJob() {}
21 23
22 void URLRequestErrorJob::Start() { 24 void URLRequestErrorJob::Start() {
23 MessageLoop::current()->PostTask( 25 MessageLoop::current()->PostTask(
24 FROM_HERE, 26 FROM_HERE,
25 base::Bind(&URLRequestErrorJob::StartAsync, weak_factory_.GetWeakPtr())); 27 base::Bind(&URLRequestErrorJob::StartAsync, weak_factory_.GetWeakPtr()));
26 } 28 }
27 29
28 void URLRequestErrorJob::StartAsync() { 30 void URLRequestErrorJob::StartAsync() {
29 NotifyStartError(URLRequestStatus(URLRequestStatus::FAILED, error_)); 31 NotifyStartError(URLRequestStatus(URLRequestStatus::FAILED, error_));
30 } 32 }
31 33
32 } // namespace net 34 } // namespace net
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698