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

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

Issue 2673543003: Migrate WTF::HashMap::remove() to ::erase() (Closed)
Patch Set: Created 3 years, 10 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 949 matching lines...) Expand 10 before | Expand all | Expand 10 after
960 return; 960 return;
961 961
962 if (m_state->booleanProperty(NetworkAgentState::monitoringXHR, false)) { 962 if (m_state->booleanProperty(NetworkAgentState::monitoringXHR, false)) {
963 String message = 963 String message =
964 (success ? "XHR finished loading: " : "XHR failed loading: ") + method + 964 (success ? "XHR finished loading: " : "XHR failed loading: ") + method +
965 " \"" + url + "\"."; 965 " \"" + url + "\".";
966 ConsoleMessage* consoleMessage = ConsoleMessage::createForRequest( 966 ConsoleMessage* consoleMessage = ConsoleMessage::createForRequest(
967 NetworkMessageSource, InfoMessageLevel, message, url, it->value); 967 NetworkMessageSource, InfoMessageLevel, message, url, it->value);
968 m_inspectedFrames->root()->console().addMessageToStorage(consoleMessage); 968 m_inspectedFrames->root()->console().addMessageToStorage(consoleMessage);
969 } 969 }
970 m_knownRequestIdMap.remove(client); 970 m_knownRequestIdMap.erase(client);
971 } 971 }
972 972
973 void InspectorNetworkAgent::willStartFetch(ThreadableLoaderClient* client) { 973 void InspectorNetworkAgent::willStartFetch(ThreadableLoaderClient* client) {
974 DCHECK(!m_pendingRequest); 974 DCHECK(!m_pendingRequest);
975 m_pendingRequest = client; 975 m_pendingRequest = client;
976 m_pendingRequestType = InspectorPageAgent::FetchResource; 976 m_pendingRequestType = InspectorPageAgent::FetchResource;
977 } 977 }
978 978
979 void InspectorNetworkAgent::didFailFetch(ThreadableLoaderClient* client) { 979 void InspectorNetworkAgent::didFailFetch(ThreadableLoaderClient* client) {
980 m_knownRequestIdMap.remove(client); 980 m_knownRequestIdMap.erase(client);
981 } 981 }
982 982
983 void InspectorNetworkAgent::didFinishFetch(ExecutionContext* context, 983 void InspectorNetworkAgent::didFinishFetch(ExecutionContext* context,
984 ThreadableLoaderClient* client, 984 ThreadableLoaderClient* client,
985 const AtomicString& method, 985 const AtomicString& method,
986 const String& url) { 986 const String& url) {
987 ThreadableLoaderClientRequestIdMap::iterator it = 987 ThreadableLoaderClientRequestIdMap::iterator it =
988 m_knownRequestIdMap.find(client); 988 m_knownRequestIdMap.find(client);
989 if (it == m_knownRequestIdMap.end()) 989 if (it == m_knownRequestIdMap.end())
990 return; 990 return;
991 991
992 if (m_state->booleanProperty(NetworkAgentState::monitoringXHR, false)) { 992 if (m_state->booleanProperty(NetworkAgentState::monitoringXHR, false)) {
993 String message = "Fetch complete: " + method + " \"" + url + "\"."; 993 String message = "Fetch complete: " + method + " \"" + url + "\".";
994 ConsoleMessage* consoleMessage = ConsoleMessage::createForRequest( 994 ConsoleMessage* consoleMessage = ConsoleMessage::createForRequest(
995 NetworkMessageSource, InfoMessageLevel, message, url, it->value); 995 NetworkMessageSource, InfoMessageLevel, message, url, it->value);
996 m_inspectedFrames->root()->console().addMessageToStorage(consoleMessage); 996 m_inspectedFrames->root()->console().addMessageToStorage(consoleMessage);
997 } 997 }
998 m_knownRequestIdMap.remove(client); 998 m_knownRequestIdMap.erase(client);
999 } 999 }
1000 1000
1001 void InspectorNetworkAgent::willSendEventSourceRequest( 1001 void InspectorNetworkAgent::willSendEventSourceRequest(
1002 ThreadableLoaderClient* eventSource) { 1002 ThreadableLoaderClient* eventSource) {
1003 DCHECK(!m_pendingRequest); 1003 DCHECK(!m_pendingRequest);
1004 m_pendingRequest = eventSource; 1004 m_pendingRequest = eventSource;
1005 m_pendingRequestType = InspectorPageAgent::EventSourceResource; 1005 m_pendingRequestType = InspectorPageAgent::EventSourceResource;
1006 } 1006 }
1007 1007
1008 void InspectorNetworkAgent::willDispatchEventSourceEvent( 1008 void InspectorNetworkAgent::willDispatchEventSourceEvent(
1009 ThreadableLoaderClient* eventSource, 1009 ThreadableLoaderClient* eventSource,
1010 const AtomicString& eventName, 1010 const AtomicString& eventName,
1011 const AtomicString& eventId, 1011 const AtomicString& eventId,
1012 const String& data) { 1012 const String& data) {
1013 ThreadableLoaderClientRequestIdMap::iterator it = 1013 ThreadableLoaderClientRequestIdMap::iterator it =
1014 m_knownRequestIdMap.find(eventSource); 1014 m_knownRequestIdMap.find(eventSource);
1015 if (it == m_knownRequestIdMap.end()) 1015 if (it == m_knownRequestIdMap.end())
1016 return; 1016 return;
1017 frontend()->eventSourceMessageReceived( 1017 frontend()->eventSourceMessageReceived(
1018 IdentifiersFactory::requestId(it->value), monotonicallyIncreasingTime(), 1018 IdentifiersFactory::requestId(it->value), monotonicallyIncreasingTime(),
1019 eventName.getString(), eventId.getString(), data); 1019 eventName.getString(), eventId.getString(), data);
1020 } 1020 }
1021 1021
1022 void InspectorNetworkAgent::didFinishEventSourceRequest( 1022 void InspectorNetworkAgent::didFinishEventSourceRequest(
1023 ThreadableLoaderClient* eventSource) { 1023 ThreadableLoaderClient* eventSource) {
1024 m_knownRequestIdMap.remove(eventSource); 1024 m_knownRequestIdMap.erase(eventSource);
1025 clearPendingRequestData(); 1025 clearPendingRequestData();
1026 } 1026 }
1027 1027
1028 void InspectorNetworkAgent::detachClientRequest( 1028 void InspectorNetworkAgent::detachClientRequest(
1029 ThreadableLoaderClient* client) { 1029 ThreadableLoaderClient* client) {
1030 // This method is called by loader clients when finalizing 1030 // This method is called by loader clients when finalizing
1031 // (i.e., from their "prefinalizers".) The client reference must 1031 // (i.e., from their "prefinalizers".) The client reference must
1032 // no longer be held onto upon completion. 1032 // no longer be held onto upon completion.
1033 if (m_pendingRequest == client) { 1033 if (m_pendingRequest == client) {
1034 m_pendingRequest = nullptr; 1034 m_pendingRequest = nullptr;
1035 if (m_pendingRequestType == InspectorPageAgent::XHRResource) { 1035 if (m_pendingRequestType == InspectorPageAgent::XHRResource) {
1036 m_pendingXHRReplayData.clear(); 1036 m_pendingXHRReplayData.clear();
1037 } 1037 }
1038 } 1038 }
1039 m_knownRequestIdMap.remove(client); 1039 m_knownRequestIdMap.erase(client);
1040 } 1040 }
1041 1041
1042 void InspectorNetworkAgent::applyUserAgentOverride(String* userAgent) { 1042 void InspectorNetworkAgent::applyUserAgentOverride(String* userAgent) {
1043 String userAgentOverride; 1043 String userAgentOverride;
1044 m_state->getString(NetworkAgentState::userAgentOverride, &userAgentOverride); 1044 m_state->getString(NetworkAgentState::userAgentOverride, &userAgentOverride);
1045 if (!userAgentOverride.isEmpty()) 1045 if (!userAgentOverride.isEmpty())
1046 *userAgent = userAgentOverride; 1046 *userAgent = userAgentOverride;
1047 } 1047 }
1048 1048
1049 void InspectorNetworkAgent::willRecalculateStyle(Document*) { 1049 void InspectorNetworkAgent::willRecalculateStyle(Document*) {
(...skipping 440 matching lines...) Expand 10 before | Expand all | Expand 10 after
1490 1490
1491 void InspectorNetworkAgent::frameScheduledNavigation(LocalFrame* frame, 1491 void InspectorNetworkAgent::frameScheduledNavigation(LocalFrame* frame,
1492 double) { 1492 double) {
1493 std::unique_ptr<protocol::Network::Initiator> initiator = 1493 std::unique_ptr<protocol::Network::Initiator> initiator =
1494 buildInitiatorObject(frame->document(), FetchInitiatorInfo()); 1494 buildInitiatorObject(frame->document(), FetchInitiatorInfo());
1495 m_frameNavigationInitiatorMap.set(IdentifiersFactory::frameId(frame), 1495 m_frameNavigationInitiatorMap.set(IdentifiersFactory::frameId(frame),
1496 std::move(initiator)); 1496 std::move(initiator));
1497 } 1497 }
1498 1498
1499 void InspectorNetworkAgent::frameClearedScheduledNavigation(LocalFrame* frame) { 1499 void InspectorNetworkAgent::frameClearedScheduledNavigation(LocalFrame* frame) {
1500 m_frameNavigationInitiatorMap.remove(IdentifiersFactory::frameId(frame)); 1500 m_frameNavigationInitiatorMap.erase(IdentifiersFactory::frameId(frame));
1501 } 1501 }
1502 1502
1503 void InspectorNetworkAgent::setHostId(const String& hostId) { 1503 void InspectorNetworkAgent::setHostId(const String& hostId) {
1504 m_hostId = hostId; 1504 m_hostId = hostId;
1505 } 1505 }
1506 1506
1507 bool InspectorNetworkAgent::fetchResourceContent(Document* document, 1507 bool InspectorNetworkAgent::fetchResourceContent(Document* document,
1508 const KURL& url, 1508 const KURL& url,
1509 String* content, 1509 String* content,
1510 bool* base64Encoded) { 1510 bool* base64Encoded) {
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after
1548 TaskRunnerHelper::get(TaskType::UnspecedLoading, 1548 TaskRunnerHelper::get(TaskType::UnspecedLoading,
1549 inspectedFrames->root()), 1549 inspectedFrames->root()),
1550 this, 1550 this,
1551 &InspectorNetworkAgent::removeFinishedReplayXHRFired) {} 1551 &InspectorNetworkAgent::removeFinishedReplayXHRFired) {}
1552 1552
1553 bool InspectorNetworkAgent::shouldForceCORSPreflight() { 1553 bool InspectorNetworkAgent::shouldForceCORSPreflight() {
1554 return m_state->booleanProperty(NetworkAgentState::cacheDisabled, false); 1554 return m_state->booleanProperty(NetworkAgentState::cacheDisabled, false);
1555 } 1555 }
1556 1556
1557 } // namespace blink 1557 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698