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

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

Issue 2578983002: Loading: move V8DOMActivityLogger dependency from core/fetch (Closed)
Patch Set: merge 2572373003/#ps20001 Created 4 years 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 13 matching lines...) Expand all
24 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 24 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
25 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 25 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
26 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 26 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
27 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 27 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
28 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 28 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
29 */ 29 */
30 30
31 #include "core/loader/FrameFetchContext.h" 31 #include "core/loader/FrameFetchContext.h"
32 32
33 #include "bindings/core/v8/ScriptController.h" 33 #include "bindings/core/v8/ScriptController.h"
34 #include "bindings/core/v8/V8DOMActivityLogger.h"
34 #include "core/dom/Document.h" 35 #include "core/dom/Document.h"
35 #include "core/fetch/ClientHintsPreferences.h" 36 #include "core/fetch/ClientHintsPreferences.h"
37 #include "core/fetch/FetchInitiatorTypeNames.h"
38 #include "core/fetch/Resource.h"
36 #include "core/fetch/ResourceLoadingLog.h" 39 #include "core/fetch/ResourceLoadingLog.h"
37 #include "core/fetch/UniqueIdentifier.h" 40 #include "core/fetch/UniqueIdentifier.h"
38 #include "core/frame/FrameConsole.h" 41 #include "core/frame/FrameConsole.h"
39 #include "core/frame/FrameHost.h" 42 #include "core/frame/FrameHost.h"
40 #include "core/frame/FrameView.h" 43 #include "core/frame/FrameView.h"
41 #include "core/frame/LocalDOMWindow.h" 44 #include "core/frame/LocalDOMWindow.h"
42 #include "core/frame/LocalFrame.h" 45 #include "core/frame/LocalFrame.h"
43 #include "core/frame/Settings.h" 46 #include "core/frame/Settings.h"
44 #include "core/frame/UseCounter.h" 47 #include "core/frame/UseCounter.h"
45 #include "core/html/HTMLFrameOwnerElement.h" 48 #include "core/html/HTMLFrameOwnerElement.h"
(...skipping 23 matching lines...) Expand all
69 #include "platform/network/NetworkUtils.h" 72 #include "platform/network/NetworkUtils.h"
70 #include "platform/network/ResourceLoadPriority.h" 73 #include "platform/network/ResourceLoadPriority.h"
71 #include "platform/network/ResourceTimingInfo.h" 74 #include "platform/network/ResourceTimingInfo.h"
72 #include "platform/tracing/TracedValue.h" 75 #include "platform/tracing/TracedValue.h"
73 #include "platform/weborigin/SchemeRegistry.h" 76 #include "platform/weborigin/SchemeRegistry.h"
74 #include "platform/weborigin/SecurityPolicy.h" 77 #include "platform/weborigin/SecurityPolicy.h"
75 #include "public/platform/WebCachePolicy.h" 78 #include "public/platform/WebCachePolicy.h"
76 #include "public/platform/WebDocumentSubresourceFilter.h" 79 #include "public/platform/WebDocumentSubresourceFilter.h"
77 #include "public/platform/WebInsecureRequestPolicy.h" 80 #include "public/platform/WebInsecureRequestPolicy.h"
78 #include "public/platform/WebViewScheduler.h" 81 #include "public/platform/WebViewScheduler.h"
82 #include "wtf/Vector.h"
79 #include <algorithm> 83 #include <algorithm>
80 #include <memory> 84 #include <memory>
81 85
82 namespace blink { 86 namespace blink {
83 87
84 namespace { 88 namespace {
85 89
86 void emitWarningForDocWriteScripts(const String& url, Document& document) { 90 void emitWarningForDocWriteScripts(const String& url, Document& document) {
87 String message = "A Parser-blocking, cross-origin script, " + url + 91 String message = "A Parser-blocking, cross-origin script, " + url +
88 ", is invoked via document.write. This may be blocked by " 92 ", is invoked via document.write. This may be blocked by "
(...skipping 432 matching lines...) Expand 10 before | Expand all | Expand 10 after
521 loadResourceTraceData(unsigned long identifier, const KURL& url, int priority) { 525 loadResourceTraceData(unsigned long identifier, const KURL& url, int priority) {
522 String requestId = IdentifiersFactory::requestId(identifier); 526 String requestId = IdentifiersFactory::requestId(identifier);
523 527
524 std::unique_ptr<TracedValue> value = TracedValue::create(); 528 std::unique_ptr<TracedValue> value = TracedValue::create();
525 value->setString("requestId", requestId); 529 value->setString("requestId", requestId);
526 value->setString("url", url.getString()); 530 value->setString("url", url.getString());
527 value->setInteger("priority", priority); 531 value->setInteger("priority", priority);
528 return value; 532 return value;
529 } 533 }
530 534
531 void FrameFetchContext::willStartLoadingResource(unsigned long identifier, 535 void FrameFetchContext::willStartLoadingResource(
532 ResourceRequest& request, 536 unsigned long identifier,
533 Resource::Type type) { 537 ResourceRequest& request,
538 Resource::Type type,
539 const AtomicString& fetchInitiatorName,
540 bool forPreload) {
534 TRACE_EVENT_ASYNC_BEGIN1( 541 TRACE_EVENT_ASYNC_BEGIN1(
535 "blink.net", "Resource", identifier, "data", 542 "blink.net", "Resource", identifier, "data",
536 loadResourceTraceData(identifier, request.url(), request.priority())); 543 loadResourceTraceData(identifier, request.url(), request.priority()));
537 prepareRequest(request); 544 prepareRequest(request);
538 545
539 if (!m_documentLoader || m_documentLoader->fetcher()->archive() || 546 if (!m_documentLoader || m_documentLoader->fetcher()->archive() ||
540 !request.url().isValid()) 547 !request.url().isValid())
541 return; 548 return;
542 if (type == Resource::MainResource) { 549 if (type == Resource::MainResource) {
543 m_documentLoader->applicationCacheHost()->willStartLoadingMainResource( 550 m_documentLoader->applicationCacheHost()->willStartLoadingMainResource(
544 request); 551 request);
545 } else { 552 } else {
546 m_documentLoader->applicationCacheHost()->willStartLoadingResource(request); 553 m_documentLoader->applicationCacheHost()->willStartLoadingResource(request);
547 } 554 }
555 if (!forPreload) {
556 V8DOMActivityLogger* activityLogger = nullptr;
557 if (fetchInitiatorName == FetchInitiatorTypeNames::xmlhttprequest) {
558 activityLogger = V8DOMActivityLogger::currentActivityLogger();
559 } else {
560 activityLogger =
561 V8DOMActivityLogger::currentActivityLoggerIfIsolatedWorld();
562 }
563
564 if (activityLogger) {
565 Vector<String> argv;
566 argv.append(Resource::resourceTypeToString(type, fetchInitiatorName));
567 argv.append(request.url());
568 activityLogger->logEvent("blinkRequestResource", argv.size(),
569 argv.data());
570 }
571 }
548 } 572 }
549 573
550 void FrameFetchContext::didLoadResource(Resource* resource) { 574 void FrameFetchContext::didLoadResource(Resource* resource) {
551 if (resource->isLoadEventBlockingResourceType()) 575 if (resource->isLoadEventBlockingResourceType())
552 frame()->loader().checkCompleted(); 576 frame()->loader().checkCompleted();
553 if (m_document) 577 if (m_document)
554 FirstMeaningfulPaintDetector::from(*m_document).checkNetworkStable(); 578 FirstMeaningfulPaintDetector::from(*m_document).checkNetworkStable();
555 } 579 }
556 580
557 void FrameFetchContext::addResourceTiming(const ResourceTimingInfo& info) { 581 void FrameFetchContext::addResourceTiming(const ResourceTimingInfo& info) {
(...skipping 457 matching lines...) Expand 10 before | Expand all | Expand 10 after
1015 response); 1039 response);
1016 } 1040 }
1017 1041
1018 DEFINE_TRACE(FrameFetchContext) { 1042 DEFINE_TRACE(FrameFetchContext) {
1019 visitor->trace(m_document); 1043 visitor->trace(m_document);
1020 visitor->trace(m_documentLoader); 1044 visitor->trace(m_documentLoader);
1021 FetchContext::trace(visitor); 1045 FetchContext::trace(visitor);
1022 } 1046 }
1023 1047
1024 } // namespace blink 1048 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698