| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2013 Google Inc. All rights reserved. | 2 * Copyright (C) 2013 Google Inc. All rights reserved. |
| 3 * | 3 * |
| 4 * Redistribution and use in source and binary forms, with or without | 4 * Redistribution and use in source and binary forms, with or without |
| 5 * modification, are permitted provided that the following conditions are | 5 * modification, are permitted provided that the following conditions are |
| 6 * met: | 6 * met: |
| 7 * | 7 * |
| 8 * * Redistributions of source code must retain the above copyright | 8 * * 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 * * Redistributions in binary form must reproduce the above | 10 * * Redistributions in binary form must reproduce the above |
| (...skipping 403 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 414 void FrameFetchContext::dispatchDidChangeResourcePriority( | 414 void FrameFetchContext::dispatchDidChangeResourcePriority( |
| 415 unsigned long identifier, | 415 unsigned long identifier, |
| 416 ResourceLoadPriority loadPriority, | 416 ResourceLoadPriority loadPriority, |
| 417 int intraPriorityValue) { | 417 int intraPriorityValue) { |
| 418 TRACE_EVENT1( | 418 TRACE_EVENT1( |
| 419 "devtools.timeline", "ResourceChangePriority", "data", | 419 "devtools.timeline", "ResourceChangePriority", "data", |
| 420 InspectorChangeResourcePriorityEvent::data(identifier, loadPriority)); | 420 InspectorChangeResourcePriorityEvent::data(identifier, loadPriority)); |
| 421 probe::didChangeResourcePriority(frame(), identifier, loadPriority); | 421 probe::didChangeResourcePriority(frame(), identifier, loadPriority); |
| 422 } | 422 } |
| 423 | 423 |
| 424 void FrameFetchContext::prepareRequest(ResourceRequest& request) { | 424 void FrameFetchContext::prepareRequest(unsigned long identifier, |
| 425 ResourceRequest& request) { |
| 425 frame()->loader().applyUserAgent(request); | 426 frame()->loader().applyUserAgent(request); |
| 426 localFrameClient()->dispatchWillSendRequest(request); | 427 localFrameClient()->dispatchWillSendRequest(request); |
| 428 probe::prepareRequest(frame(), identifier, request); |
| 427 } | 429 } |
| 428 | 430 |
| 429 void FrameFetchContext::dispatchWillSendRequest( | 431 void FrameFetchContext::dispatchWillSendRequest( |
| 430 unsigned long identifier, | 432 unsigned long identifier, |
| 431 ResourceRequest& request, | 433 const ResourceRequest& request, |
| 432 const ResourceResponse& redirectResponse, | 434 const ResourceResponse& redirectResponse, |
| 433 const FetchInitiatorInfo& initiatorInfo) { | 435 const FetchInitiatorInfo& initiatorInfo) { |
| 434 // For initial requests, prepareRequest() is called in | 436 if (redirectResponse.isNull()) { |
| 435 // willStartLoadingResource(), before revalidation policy is determined. That | |
| 436 // call doesn't exist for redirects, so call preareRequest() here. | |
| 437 if (!redirectResponse.isNull()) { | |
| 438 prepareRequest(request); | |
| 439 } else { | |
| 440 frame()->loader().progress().willStartLoading(identifier, | 437 frame()->loader().progress().willStartLoading(identifier, |
| 441 request.priority()); | 438 request.priority()); |
| 442 } | 439 } |
| 443 probe::willSendRequest(frame(), identifier, masterDocumentLoader(), request, | 440 probe::willSendRequest(frame(), identifier, masterDocumentLoader(), request, |
| 444 redirectResponse, initiatorInfo); | 441 redirectResponse, initiatorInfo); |
| 445 if (frame()->frameScheduler()) | 442 if (frame()->frameScheduler()) |
| 446 frame()->frameScheduler()->didStartLoading(identifier); | 443 frame()->frameScheduler()->didStartLoading(identifier); |
| 447 } | 444 } |
| 448 | 445 |
| 449 void FrameFetchContext::dispatchDidReceiveResponse( | 446 void FrameFetchContext::dispatchDidReceiveResponse( |
| (...skipping 102 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 552 | 549 |
| 553 void FrameFetchContext::willStartLoadingResource( | 550 void FrameFetchContext::willStartLoadingResource( |
| 554 unsigned long identifier, | 551 unsigned long identifier, |
| 555 ResourceRequest& request, | 552 ResourceRequest& request, |
| 556 Resource::Type type, | 553 Resource::Type type, |
| 557 const AtomicString& fetchInitiatorName, | 554 const AtomicString& fetchInitiatorName, |
| 558 V8ActivityLoggingPolicy loggingPolicy) { | 555 V8ActivityLoggingPolicy loggingPolicy) { |
| 559 TRACE_EVENT_ASYNC_BEGIN1( | 556 TRACE_EVENT_ASYNC_BEGIN1( |
| 560 "blink.net", "Resource", identifier, "data", | 557 "blink.net", "Resource", identifier, "data", |
| 561 loadResourceTraceData(identifier, request.url(), request.priority())); | 558 loadResourceTraceData(identifier, request.url(), request.priority())); |
| 562 prepareRequest(request); | |
| 563 | 559 |
| 564 if (!m_documentLoader || m_documentLoader->fetcher()->archive() || | 560 if (!m_documentLoader || m_documentLoader->fetcher()->archive() || |
| 565 !request.url().isValid()) | 561 !request.url().isValid()) |
| 566 return; | 562 return; |
| 567 if (type == Resource::MainResource) { | 563 if (type == Resource::MainResource) { |
| 568 m_documentLoader->applicationCacheHost()->willStartLoadingMainResource( | 564 m_documentLoader->applicationCacheHost()->willStartLoadingMainResource( |
| 569 request); | 565 request); |
| 570 } else { | 566 } else { |
| 571 m_documentLoader->applicationCacheHost()->willStartLoadingResource(request); | 567 m_documentLoader->applicationCacheHost()->willStartLoadingResource(request); |
| 572 } | 568 } |
| (...skipping 481 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1054 response); | 1050 response); |
| 1055 } | 1051 } |
| 1056 | 1052 |
| 1057 DEFINE_TRACE(FrameFetchContext) { | 1053 DEFINE_TRACE(FrameFetchContext) { |
| 1058 visitor->trace(m_document); | 1054 visitor->trace(m_document); |
| 1059 visitor->trace(m_documentLoader); | 1055 visitor->trace(m_documentLoader); |
| 1060 FetchContext::trace(visitor); | 1056 FetchContext::trace(visitor); |
| 1061 } | 1057 } |
| 1062 | 1058 |
| 1063 } // namespace blink | 1059 } // namespace blink |
| OLD | NEW |