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

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

Issue 10830124: Removed checks that verify URLRequest has a Context (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 8 years, 4 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 | Annotate | Revision Log
« no previous file with comments | « net/url_request/url_request_http_job.cc ('k') | net/url_request/url_request_throttler_entry.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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_job_manager.h" 5 #include "net/url_request/url_request_job_manager.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 8
9 #include "base/memory/singleton.h" 9 #include "base/memory/singleton.h"
10 #include "build/build_config.h" 10 #include "build/build_config.h"
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after
50 URLRequestJob* URLRequestJobManager::CreateJob( 50 URLRequestJob* URLRequestJobManager::CreateJob(
51 URLRequest* request) const { 51 URLRequest* request) const {
52 DCHECK(IsAllowedThread()); 52 DCHECK(IsAllowedThread());
53 53
54 // If we are given an invalid URL, then don't even try to inspect the scheme. 54 // If we are given an invalid URL, then don't even try to inspect the scheme.
55 if (!request->url().is_valid()) 55 if (!request->url().is_valid())
56 return new URLRequestErrorJob(request, ERR_INVALID_URL); 56 return new URLRequestErrorJob(request, ERR_INVALID_URL);
57 57
58 // We do this here to avoid asking interceptors about unsupported schemes. 58 // We do this here to avoid asking interceptors about unsupported schemes.
59 const URLRequestJobFactory* job_factory = NULL; 59 const URLRequestJobFactory* job_factory = NULL;
60 if (request->context()) 60 job_factory = request->context()->job_factory();
61 job_factory = request->context()->job_factory();
62 61
63 const std::string& scheme = request->url().scheme(); // already lowercase 62 const std::string& scheme = request->url().scheme(); // already lowercase
64 if (job_factory) { 63 if (job_factory) {
65 if (!job_factory->IsHandledProtocol(scheme)) { 64 if (!job_factory->IsHandledProtocol(scheme)) {
66 return new URLRequestErrorJob(request, ERR_UNKNOWN_URL_SCHEME); 65 return new URLRequestErrorJob(request, ERR_UNKNOWN_URL_SCHEME);
67 } 66 }
68 } else if (!SupportsScheme(scheme)) { 67 } else if (!SupportsScheme(scheme)) {
69 return new URLRequestErrorJob(request, ERR_UNKNOWN_URL_SCHEME); 68 return new URLRequestErrorJob(request, ERR_UNKNOWN_URL_SCHEME);
70 } 69 }
71 70
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after
131 URLRequest* request, 130 URLRequest* request,
132 const GURL& location) const { 131 const GURL& location) const {
133 DCHECK(IsAllowedThread()); 132 DCHECK(IsAllowedThread());
134 if (!request->url().is_valid() || 133 if (!request->url().is_valid() ||
135 request->load_flags() & LOAD_DISABLE_INTERCEPT || 134 request->load_flags() & LOAD_DISABLE_INTERCEPT ||
136 request->status().status() == URLRequestStatus::CANCELED) { 135 request->status().status() == URLRequestStatus::CANCELED) {
137 return NULL; 136 return NULL;
138 } 137 }
139 138
140 const URLRequestJobFactory* job_factory = NULL; 139 const URLRequestJobFactory* job_factory = NULL;
141 if (request->context()) 140 job_factory = request->context()->job_factory();
142 job_factory = request->context()->job_factory();
143 141
144 const std::string& scheme = request->url().scheme(); // already lowercase 142 const std::string& scheme = request->url().scheme(); // already lowercase
145 if (job_factory) { 143 if (job_factory) {
146 if (!job_factory->IsHandledProtocol(scheme)) { 144 if (!job_factory->IsHandledProtocol(scheme)) {
147 return NULL; 145 return NULL;
148 } 146 }
149 } else if (!SupportsScheme(scheme)) { 147 } else if (!SupportsScheme(scheme)) {
150 return NULL; 148 return NULL;
151 } 149 }
152 150
(...skipping 15 matching lines...) Expand all
168 URLRequestJob* URLRequestJobManager::MaybeInterceptResponse( 166 URLRequestJob* URLRequestJobManager::MaybeInterceptResponse(
169 URLRequest* request) const { 167 URLRequest* request) const {
170 DCHECK(IsAllowedThread()); 168 DCHECK(IsAllowedThread());
171 if (!request->url().is_valid() || 169 if (!request->url().is_valid() ||
172 request->load_flags() & LOAD_DISABLE_INTERCEPT || 170 request->load_flags() & LOAD_DISABLE_INTERCEPT ||
173 request->status().status() == URLRequestStatus::CANCELED) { 171 request->status().status() == URLRequestStatus::CANCELED) {
174 return NULL; 172 return NULL;
175 } 173 }
176 174
177 const URLRequestJobFactory* job_factory = NULL; 175 const URLRequestJobFactory* job_factory = NULL;
178 if (request->context()) 176 job_factory = request->context()->job_factory();
179 job_factory = request->context()->job_factory();
180 177
181 const std::string& scheme = request->url().scheme(); // already lowercase 178 const std::string& scheme = request->url().scheme(); // already lowercase
182 if (job_factory) { 179 if (job_factory) {
183 if (!job_factory->IsHandledProtocol(scheme)) { 180 if (!job_factory->IsHandledProtocol(scheme)) {
184 return NULL; 181 return NULL;
185 } 182 }
186 } else if (!SupportsScheme(scheme)) { 183 } else if (!SupportsScheme(scheme)) {
187 return NULL; 184 return NULL;
188 } 185 }
189 186
(...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after
263 } 260 }
264 261
265 URLRequestJobManager::URLRequestJobManager() 262 URLRequestJobManager::URLRequestJobManager()
266 : allowed_thread_(0), 263 : allowed_thread_(0),
267 allowed_thread_initialized_(false) { 264 allowed_thread_initialized_(false) {
268 } 265 }
269 266
270 URLRequestJobManager::~URLRequestJobManager() {} 267 URLRequestJobManager::~URLRequestJobManager() {}
271 268
272 } // namespace net 269 } // namespace net
OLDNEW
« no previous file with comments | « net/url_request/url_request_http_job.cc ('k') | net/url_request/url_request_throttler_entry.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698