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

Side by Side Diff: third_party/WebKit/Source/core/inspector/InspectorNetworkAgent.cpp

Issue 2251343003: [DevTools] Generate separate copies of inspector_protocol. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: win compile Created 4 years, 3 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) 2011 Google Inc. All rights reserved. 2 * Copyright (C) 2011 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 524 matching lines...) Expand 10 before | Expand all | Expand 10 after
535 if (initiatorInfo.name == FetchInitiatorTypeNames::internal) 535 if (initiatorInfo.name == FetchInitiatorTypeNames::internal)
536 return; 536 return;
537 537
538 if (initiatorInfo.name == FetchInitiatorTypeNames::document && loader->subst ituteData().isValid()) 538 if (initiatorInfo.name == FetchInitiatorTypeNames::document && loader->subst ituteData().isValid())
539 return; 539 return;
540 540
541 protocol::DictionaryValue* headers = m_state->getObject(NetworkAgentState::e xtraRequestHeaders); 541 protocol::DictionaryValue* headers = m_state->getObject(NetworkAgentState::e xtraRequestHeaders);
542 if (headers) { 542 if (headers) {
543 for (size_t i = 0; i < headers->size(); ++i) { 543 for (size_t i = 0; i < headers->size(); ++i) {
544 auto header = headers->at(i); 544 auto header = headers->at(i);
545 String16 value; 545 String value;
546 if (header.second->asString(&value)) 546 if (header.second->asString(&value))
547 request.setHTTPHeaderField(AtomicString(header.first), AtomicStr ing(String(value))); 547 request.setHTTPHeaderField(AtomicString(header.first), AtomicStr ing(value));
548 } 548 }
549 } 549 }
550 550
551 request.setReportRawHeaders(true); 551 request.setReportRawHeaders(true);
552 552
553 if (m_state->booleanProperty(NetworkAgentState::cacheDisabled, false)) { 553 if (m_state->booleanProperty(NetworkAgentState::cacheDisabled, false)) {
554 request.setCachePolicy(WebCachePolicy::BypassingCache); 554 request.setCachePolicy(WebCachePolicy::BypassingCache);
555 request.setShouldResetAppCache(true); 555 request.setShouldResetAppCache(true);
556 } 556 }
557 if (m_state->booleanProperty(NetworkAgentState::bypassServiceWorker, false)) 557 if (m_state->booleanProperty(NetworkAgentState::bypassServiceWorker, false))
(...skipping 229 matching lines...) Expand 10 before | Expand all | Expand 10 after
787 } 787 }
788 788
789 void InspectorNetworkAgent::didFinishEventSourceRequest(ThreadableLoaderClient* eventSource) 789 void InspectorNetworkAgent::didFinishEventSourceRequest(ThreadableLoaderClient* eventSource)
790 { 790 {
791 m_knownRequestIdMap.remove(eventSource); 791 m_knownRequestIdMap.remove(eventSource);
792 clearPendingRequestData(); 792 clearPendingRequestData();
793 } 793 }
794 794
795 void InspectorNetworkAgent::applyUserAgentOverride(String* userAgent) 795 void InspectorNetworkAgent::applyUserAgentOverride(String* userAgent)
796 { 796 {
797 String16 userAgentOverride; 797 String userAgentOverride;
798 m_state->getString(NetworkAgentState::userAgentOverride, &userAgentOverride) ; 798 m_state->getString(NetworkAgentState::userAgentOverride, &userAgentOverride) ;
799 if (!userAgentOverride.isEmpty()) 799 if (!userAgentOverride.isEmpty())
800 *userAgent = userAgentOverride; 800 *userAgent = userAgentOverride;
801 } 801 }
802 802
803 void InspectorNetworkAgent::willRecalculateStyle(Document*) 803 void InspectorNetworkAgent::willRecalculateStyle(Document*)
804 { 804 {
805 DCHECK(!m_isRecalculatingStyle); 805 DCHECK(!m_isRecalculatingStyle);
806 m_isRecalculatingStyle = true; 806 m_isRecalculatingStyle = true;
807 } 807 }
808 808
809 void InspectorNetworkAgent::didRecalculateStyle() 809 void InspectorNetworkAgent::didRecalculateStyle()
810 { 810 {
811 m_isRecalculatingStyle = false; 811 m_isRecalculatingStyle = false;
812 m_styleRecalculationInitiator = nullptr; 812 m_styleRecalculationInitiator = nullptr;
813 } 813 }
814 814
815 void InspectorNetworkAgent::didScheduleStyleRecalculation(Document* document) 815 void InspectorNetworkAgent::didScheduleStyleRecalculation(Document* document)
816 { 816 {
817 if (!m_styleRecalculationInitiator) 817 if (!m_styleRecalculationInitiator)
818 m_styleRecalculationInitiator = buildInitiatorObject(document, FetchInit iatorInfo()); 818 m_styleRecalculationInitiator = buildInitiatorObject(document, FetchInit iatorInfo());
819 } 819 }
820 820
821 std::unique_ptr<protocol::Network::Initiator> InspectorNetworkAgent::buildInitia torObject(Document* document, const FetchInitiatorInfo& initiatorInfo) 821 std::unique_ptr<protocol::Network::Initiator> InspectorNetworkAgent::buildInitia torObject(Document* document, const FetchInitiatorInfo& initiatorInfo)
822 { 822 {
823 std::unique_ptr<protocol::Runtime::API::StackTrace> currentStackTrace = Sour ceLocation::capture(document)->buildInspectorObject(); 823 std::unique_ptr<v8_inspector::protocol::Runtime::API::StackTrace> currentSta ckTrace = SourceLocation::capture(document)->buildInspectorObject();
824 if (currentStackTrace) { 824 if (currentStackTrace) {
825 std::unique_ptr<protocol::Network::Initiator> initiatorObject = protocol ::Network::Initiator::create() 825 std::unique_ptr<protocol::Network::Initiator> initiatorObject = protocol ::Network::Initiator::create()
826 .setType(protocol::Network::Initiator::TypeEnum::Script).build(); 826 .setType(protocol::Network::Initiator::TypeEnum::Script).build();
827 initiatorObject->setStack(std::move(currentStackTrace)); 827 initiatorObject->setStack(std::move(currentStackTrace));
828 return initiatorObject; 828 return initiatorObject;
829 } 829 }
830 830
831 while (document && !document->scriptableDocumentParser()) 831 while (document && !document->scriptableDocumentParser())
832 document = document->localOwner() ? document->localOwner()->ownerDocumen t() : nullptr; 832 document = document->localOwner() ? document->localOwner()->ownerDocumen t() : nullptr;
833 if (document && document->scriptableDocumentParser()) { 833 if (document && document->scriptableDocumentParser()) {
834 std::unique_ptr<protocol::Network::Initiator> initiatorObject = protocol ::Network::Initiator::create() 834 std::unique_ptr<protocol::Network::Initiator> initiatorObject = protocol ::Network::Initiator::create()
835 .setType(protocol::Network::Initiator::TypeEnum::Parser).build(); 835 .setType(protocol::Network::Initiator::TypeEnum::Parser).build();
836 initiatorObject->setUrl(urlWithoutFragment(document->url()).getString()) ; 836 initiatorObject->setUrl(urlWithoutFragment(document->url()).getString()) ;
837 if (TextPosition::belowRangePosition() != initiatorInfo.position) 837 if (TextPosition::belowRangePosition() != initiatorInfo.position)
838 initiatorObject->setLineNumber(initiatorInfo.position.m_line.zeroBas edInt()); 838 initiatorObject->setLineNumber(initiatorInfo.position.m_line.zeroBas edInt());
839 else 839 else
840 initiatorObject->setLineNumber(document->scriptableDocumentParser()- >lineNumber().zeroBasedInt()); 840 initiatorObject->setLineNumber(document->scriptableDocumentParser()- >lineNumber().zeroBasedInt());
841 return initiatorObject; 841 return initiatorObject;
842 } 842 }
843 843
844 if (m_isRecalculatingStyle && m_styleRecalculationInitiator) 844 if (m_isRecalculatingStyle && m_styleRecalculationInitiator)
845 return m_styleRecalculationInitiator->clone(); 845 return m_styleRecalculationInitiator->clone();
846 846
847 return protocol::Network::Initiator::create() 847 return protocol::Network::Initiator::create()
848 .setType(protocol::Network::Initiator::TypeEnum::Other).build(); 848 .setType(protocol::Network::Initiator::TypeEnum::Other).build();
849 } 849 }
850 850
851 void InspectorNetworkAgent::didCreateWebSocket(Document* document, unsigned long identifier, const KURL& requestURL, const String&) 851 void InspectorNetworkAgent::didCreateWebSocket(Document* document, unsigned long identifier, const KURL& requestURL, const String&)
852 { 852 {
853 std::unique_ptr<protocol::Runtime::API::StackTrace> currentStackTrace = Sour ceLocation::capture(document)->buildInspectorObject(); 853 std::unique_ptr<v8_inspector::protocol::Runtime::API::StackTrace> currentSta ckTrace = SourceLocation::capture(document)->buildInspectorObject();
854 if (!currentStackTrace) { 854 if (!currentStackTrace) {
855 frontend()->webSocketCreated(IdentifiersFactory::requestId(identifier), urlWithoutFragment(requestURL).getString()); 855 frontend()->webSocketCreated(IdentifiersFactory::requestId(identifier), urlWithoutFragment(requestURL).getString());
856 return; 856 return;
857 } 857 }
858 858
859 std::unique_ptr<protocol::Network::Initiator> initiatorObject = protocol::Ne twork::Initiator::create() 859 std::unique_ptr<protocol::Network::Initiator> initiatorObject = protocol::Ne twork::Initiator::create()
860 .setType(protocol::Network::Initiator::TypeEnum::Script).build(); 860 .setType(protocol::Network::Initiator::TypeEnum::Script).build();
861 initiatorObject->setStack(std::move(currentStackTrace)); 861 initiatorObject->setStack(std::move(currentStackTrace));
862 frontend()->webSocketCreated(IdentifiersFactory::requestId(identifier), urlW ithoutFragment(requestURL).getString(), std::move(initiatorObject)); 862 frontend()->webSocketCreated(IdentifiersFactory::requestId(identifier), urlW ithoutFragment(requestURL).getString(), std::move(initiatorObject));
863 } 863 }
(...skipping 316 matching lines...) Expand 10 before | Expand all | Expand 10 after
1180 , m_removeFinishedReplayXHRTimer(this, &InspectorNetworkAgent::removeFinishe dReplayXHRFired) 1180 , m_removeFinishedReplayXHRTimer(this, &InspectorNetworkAgent::removeFinishe dReplayXHRFired)
1181 { 1181 {
1182 } 1182 }
1183 1183
1184 bool InspectorNetworkAgent::shouldForceCORSPreflight() 1184 bool InspectorNetworkAgent::shouldForceCORSPreflight()
1185 { 1185 {
1186 return m_state->booleanProperty(NetworkAgentState::cacheDisabled, false); 1186 return m_state->booleanProperty(NetworkAgentState::cacheDisabled, false);
1187 } 1187 }
1188 1188
1189 } // namespace blink 1189 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698