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

Side by Side Diff: Source/platform/network/ResourceRequest.cpp

Issue 339593005: Set the target type when creating the request for main resource (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Made the setter method private Created 6 years, 5 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 /* 1 /*
2 * Copyright (C) 2003, 2006 Apple Computer, Inc. All rights reserved. 2 * Copyright (C) 2003, 2006 Apple Computer, Inc. All rights reserved.
3 * Copyright (C) 2009, 2012 Google Inc. All rights reserved. 3 * Copyright (C) 2009, 2012 Google Inc. All rights reserved.
4 * 4 *
5 * Redistribution and use in source and binary forms, with or without 5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions 6 * modification, are permitted provided that the following conditions
7 * are met: 7 * are met:
8 * 1. Redistributions of source code must retain the above copyright 8 * 1. Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer. 9 * notice, this list of conditions and the following disclaimer.
10 * 2. Redistributions in binary form must reproduce the above copyright 10 * 2. Redistributions in binary form must reproduce the above copyright
(...skipping 13 matching lines...) Expand all
24 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 24 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
25 */ 25 */
26 26
27 #include "config.h" 27 #include "config.h"
28 #include "platform/network/ResourceRequest.h" 28 #include "platform/network/ResourceRequest.h"
29 29
30 namespace WebCore { 30 namespace WebCore {
31 31
32 double ResourceRequest::s_defaultTimeoutInterval = INT_MAX; 32 double ResourceRequest::s_defaultTimeoutInterval = INT_MAX;
33 33
34
35 ResourceRequest ResourceRequest::createMainResourceRequest(const KURL& url, bool isMainFrame)
36 {
37 ResourceRequest request = ResourceRequest(url);
38 request.setTargetTypeForMainResource(isMainFrame);
39 return request;
40 }
41
42 ResourceRequest ResourceRequest::createMainResourceRequest(
43 const KURL& url, bool isMainFrame, const Referrer& referrer,
44 ResourceRequestCachePolicy cachePolicy)
45 {
46 ResourceRequest request = ResourceRequest(url, referrer, cachePolicy);
47 request.setTargetTypeForMainResource(isMainFrame);
48 return request;
49 }
50
34 PassOwnPtr<ResourceRequest> ResourceRequest::adopt(PassOwnPtr<CrossThreadResourc eRequestData> data) 51 PassOwnPtr<ResourceRequest> ResourceRequest::adopt(PassOwnPtr<CrossThreadResourc eRequestData> data)
35 { 52 {
36 OwnPtr<ResourceRequest> request = adoptPtr(new ResourceRequest()); 53 OwnPtr<ResourceRequest> request = adoptPtr(new ResourceRequest());
37 request->setURL(data->m_url); 54 request->setURL(data->m_url);
38 request->setCachePolicy(data->m_cachePolicy); 55 request->setCachePolicy(data->m_cachePolicy);
39 request->setTimeoutInterval(data->m_timeoutInterval); 56 request->setTimeoutInterval(data->m_timeoutInterval);
40 request->setFirstPartyForCookies(data->m_firstPartyForCookies); 57 request->setFirstPartyForCookies(data->m_firstPartyForCookies);
41 request->setHTTPMethod(AtomicString(data->m_httpMethod)); 58 request->setHTTPMethod(AtomicString(data->m_httpMethod));
42 request->setPriority(data->m_priority, data->m_intraPriorityValue); 59 request->setPriority(data->m_priority, data->m_intraPriorityValue);
43 60
(...skipping 323 matching lines...) Expand 10 before | Expand all | Expand 10 after
367 m_downloadToFile = false; 384 m_downloadToFile = false;
368 m_priority = ResourceLoadPriorityLow; 385 m_priority = ResourceLoadPriorityLow;
369 m_intraPriorityValue = 0; 386 m_intraPriorityValue = 0;
370 m_requestorID = 0; 387 m_requestorID = 0;
371 m_requestorProcessID = 0; 388 m_requestorProcessID = 0;
372 m_appCacheHostID = 0; 389 m_appCacheHostID = 0;
373 m_targetType = TargetIsUnspecified; 390 m_targetType = TargetIsUnspecified;
374 m_referrerPolicy = ReferrerPolicyDefault; 391 m_referrerPolicy = ReferrerPolicyDefault;
375 } 392 }
376 393
394 void ResourceRequest::setTargetTypeForMainResource(bool isMainFrame)
395 {
396 m_targetType = isMainFrame ? TargetIsMainFrame : TargetIsSubframe;
397 }
398
377 // This is used by the loader to control the number of issued parallel load requ ests. 399 // This is used by the loader to control the number of issued parallel load requ ests.
378 unsigned initializeMaximumHTTPConnectionCountPerHost() 400 unsigned initializeMaximumHTTPConnectionCountPerHost()
379 { 401 {
380 // The chromium network stack already handles limiting the number of 402 // The chromium network stack already handles limiting the number of
381 // parallel requests per host, so there's no need to do it here. Therefore, 403 // parallel requests per host, so there's no need to do it here. Therefore,
382 // this is set to a high value that should never be hit in practice. 404 // this is set to a high value that should never be hit in practice.
383 return 10000; 405 return 10000;
384 } 406 }
385 407
386 } 408 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698