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

Side by Side Diff: third_party/WebKit/Source/core/loader/FrameFetchContext.cpp

Issue 2839683003: Server-Timing (Closed)
Patch Set: make those robots happy, attempt #4 Created 3 years, 7 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) 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 47 matching lines...) Expand 10 before | Expand all | Expand 10 after
58 #include "core/loader/ProgressTracker.h" 58 #include "core/loader/ProgressTracker.h"
59 #include "core/loader/SubresourceFilter.h" 59 #include "core/loader/SubresourceFilter.h"
60 #include "core/loader/appcache/ApplicationCacheHost.h" 60 #include "core/loader/appcache/ApplicationCacheHost.h"
61 #include "core/loader/private/FrameClientHintsPreferencesContext.h" 61 #include "core/loader/private/FrameClientHintsPreferencesContext.h"
62 #include "core/page/Page.h" 62 #include "core/page/Page.h"
63 #include "core/paint/FirstMeaningfulPaintDetector.h" 63 #include "core/paint/FirstMeaningfulPaintDetector.h"
64 #include "core/probe/CoreProbes.h" 64 #include "core/probe/CoreProbes.h"
65 #include "core/svg/graphics/SVGImageChromeClient.h" 65 #include "core/svg/graphics/SVGImageChromeClient.h"
66 #include "core/timing/DOMWindowPerformance.h" 66 #include "core/timing/DOMWindowPerformance.h"
67 #include "core/timing/Performance.h" 67 #include "core/timing/Performance.h"
68 #include "core/timing/PerformanceBase.h"
68 #include "platform/WebFrameScheduler.h" 69 #include "platform/WebFrameScheduler.h"
69 #include "platform/exported/WrappedResourceRequest.h" 70 #include "platform/exported/WrappedResourceRequest.h"
70 #include "platform/instrumentation/tracing/TracedValue.h" 71 #include "platform/instrumentation/tracing/TracedValue.h"
71 #include "platform/loader/fetch/ClientHintsPreferences.h" 72 #include "platform/loader/fetch/ClientHintsPreferences.h"
72 #include "platform/loader/fetch/FetchInitiatorTypeNames.h" 73 #include "platform/loader/fetch/FetchInitiatorTypeNames.h"
73 #include "platform/loader/fetch/Resource.h" 74 #include "platform/loader/fetch/Resource.h"
74 #include "platform/loader/fetch/ResourceLoadPriority.h" 75 #include "platform/loader/fetch/ResourceLoadPriority.h"
75 #include "platform/loader/fetch/ResourceLoadingLog.h" 76 #include "platform/loader/fetch/ResourceLoadingLog.h"
76 #include "platform/loader/fetch/ResourceTimingInfo.h" 77 #include "platform/loader/fetch/ResourceTimingInfo.h"
77 #include "platform/loader/fetch/UniqueIdentifier.h" 78 #include "platform/loader/fetch/UniqueIdentifier.h"
(...skipping 285 matching lines...) Expand 10 before | Expand all | Expand 10 after
363 } 364 }
364 365
365 GetFrame()->Loader().Progress().IncrementProgress(identifier, response); 366 GetFrame()->Loader().Progress().IncrementProgress(identifier, response);
366 GetLocalFrameClient()->DispatchDidReceiveResponse(response); 367 GetLocalFrameClient()->DispatchDidReceiveResponse(response);
367 DocumentLoader* document_loader = MasterDocumentLoader(); 368 DocumentLoader* document_loader = MasterDocumentLoader();
368 probe::didReceiveResourceResponse(GetFrame(), identifier, document_loader, 369 probe::didReceiveResourceResponse(GetFrame(), identifier, document_loader,
369 response, resource); 370 response, resource);
370 // It is essential that inspector gets resource response BEFORE console. 371 // It is essential that inspector gets resource response BEFORE console.
371 GetFrame()->Console().ReportResourceResponseReceived(document_loader, 372 GetFrame()->Console().ReportResourceResponseReceived(document_loader,
372 identifier, response); 373 identifier, response);
374
375 // MainResource responses were already added, skip them here.
376 if (RuntimeEnabledFeatures::serverTimingEnabled() &&
377 resource->GetType() != Resource::kMainResource &&
378 GetFrame()->GetDocument() && GetFrame()->GetDocument()->domWindow()) {
379 LocalDOMWindow* localDOMWindow = GetFrame()->GetDocument()->domWindow();
380 DOMWindowPerformance::performance(*localDOMWindow)
381 ->AddServerTiming(response,
382 localDOMWindow->HasLoadEventFired()
383 ? PerformanceBase::ShouldAddToBuffer::Never
384 : PerformanceBase::ShouldAddToBuffer::Always);
385 }
373 } 386 }
374 387
375 void FrameFetchContext::DispatchDidReceiveData(unsigned long identifier, 388 void FrameFetchContext::DispatchDidReceiveData(unsigned long identifier,
376 const char* data, 389 const char* data,
377 int data_length) { 390 int data_length) {
378 GetFrame()->Loader().Progress().IncrementProgress(identifier, data_length); 391 GetFrame()->Loader().Progress().IncrementProgress(identifier, data_length);
379 probe::didReceiveData(GetFrame(), identifier, data, data_length); 392 probe::didReceiveData(GetFrame(), identifier, data, data_length);
380 } 393 }
381 394
382 void FrameFetchContext::DispatchDidReceiveEncodedData(unsigned long identifier, 395 void FrameFetchContext::DispatchDidReceiveEncodedData(unsigned long identifier,
(...skipping 387 matching lines...) Expand 10 before | Expand all | Expand 10 after
770 std::unique_ptr<WebURLLoader> FrameFetchContext::CreateURLLoader() { 783 std::unique_ptr<WebURLLoader> FrameFetchContext::CreateURLLoader() {
771 return Platform::Current()->CreateURLLoader(); 784 return Platform::Current()->CreateURLLoader();
772 } 785 }
773 786
774 DEFINE_TRACE(FrameFetchContext) { 787 DEFINE_TRACE(FrameFetchContext) {
775 visitor->Trace(document_loader_); 788 visitor->Trace(document_loader_);
776 BaseFetchContext::Trace(visitor); 789 BaseFetchContext::Trace(visitor);
777 } 790 }
778 791
779 } // namespace blink 792 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698