| OLD | NEW |
| 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 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 44 #include "IdentifiersFactory.h" | 44 #include "IdentifiersFactory.h" |
| 45 #include "InspectorClient.h" | 45 #include "InspectorClient.h" |
| 46 #include "InspectorFrontend.h" | 46 #include "InspectorFrontend.h" |
| 47 #include "InspectorFrontendChannel.h" | 47 #include "InspectorFrontendChannel.h" |
| 48 #include "InspectorFrontendProxy.h" | 48 #include "InspectorFrontendProxy.h" |
| 49 #include "InspectorPageAgent.h" | 49 #include "InspectorPageAgent.h" |
| 50 #include "InspectorState.h" | 50 #include "InspectorState.h" |
| 51 #include "InspectorValues.h" | 51 #include "InspectorValues.h" |
| 52 #include "InstrumentingAgents.h" | 52 #include "InstrumentingAgents.h" |
| 53 #include "KURL.h" | 53 #include "KURL.h" |
| 54 #include "MemoryCache.h" |
| 54 #include "NetworkResourcesData.h" | 55 #include "NetworkResourcesData.h" |
| 55 #include "Page.h" | 56 #include "Page.h" |
| 56 #include "ProgressTracker.h" | 57 #include "ProgressTracker.h" |
| 57 #include "ResourceError.h" | 58 #include "ResourceError.h" |
| 58 #include "ResourceRequest.h" | 59 #include "ResourceRequest.h" |
| 59 #include "ResourceResponse.h" | 60 #include "ResourceResponse.h" |
| 60 #include "ScriptCallStack.h" | 61 #include "ScriptCallStack.h" |
| 61 #include "ScriptCallStackFactory.h" | 62 #include "ScriptCallStackFactory.h" |
| 62 #include "WebSocketHandshakeRequest.h" | 63 #include "WebSocketHandshakeRequest.h" |
| 63 #include "WebSocketHandshakeResponse.h" | 64 #include "WebSocketHandshakeResponse.h" |
| (...skipping 371 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 435 { | 436 { |
| 436 enable(); | 437 enable(); |
| 437 } | 438 } |
| 438 | 439 |
| 439 void InspectorResourceAgent::enable() | 440 void InspectorResourceAgent::enable() |
| 440 { | 441 { |
| 441 if (!m_frontend) | 442 if (!m_frontend) |
| 442 return; | 443 return; |
| 443 m_state->setBoolean(ResourceAgentState::resourceAgentEnabled, true); | 444 m_state->setBoolean(ResourceAgentState::resourceAgentEnabled, true); |
| 444 m_instrumentingAgents->setInspectorResourceAgent(this); | 445 m_instrumentingAgents->setInspectorResourceAgent(this); |
| 445 | |
| 446 m_client->setCacheDisabled(m_state->getBoolean(ResourceAgentState::cacheDisa
bled)); | |
| 447 } | 446 } |
| 448 | 447 |
| 449 void InspectorResourceAgent::disable(ErrorString*) | 448 void InspectorResourceAgent::disable(ErrorString*) |
| 450 { | 449 { |
| 451 m_state->setBoolean(ResourceAgentState::resourceAgentEnabled, false); | 450 m_state->setBoolean(ResourceAgentState::resourceAgentEnabled, false); |
| 452 m_instrumentingAgents->setInspectorResourceAgent(0); | 451 m_instrumentingAgents->setInspectorResourceAgent(0); |
| 453 m_client->setCacheDisabled(false); | |
| 454 } | 452 } |
| 455 | 453 |
| 456 void InspectorResourceAgent::setUserAgentOverride(ErrorString*, const String& us
erAgent) | 454 void InspectorResourceAgent::setUserAgentOverride(ErrorString*, const String& us
erAgent) |
| 457 { | 455 { |
| 458 m_userAgentOverride = userAgent; | 456 m_userAgentOverride = userAgent; |
| 459 } | 457 } |
| 460 | 458 |
| 461 void InspectorResourceAgent::setExtraHeaders(ErrorString*, PassRefPtr<InspectorO
bject> headers) | 459 void InspectorResourceAgent::setExtraHeaders(ErrorString*, PassRefPtr<InspectorO
bject> headers) |
| 462 { | 460 { |
| 463 m_state->setObject(ResourceAgentState::extraRequestHeaders, headers); | 461 m_state->setObject(ResourceAgentState::extraRequestHeaders, headers); |
| (...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 504 m_client->clearBrowserCache(); | 502 m_client->clearBrowserCache(); |
| 505 } | 503 } |
| 506 | 504 |
| 507 void InspectorResourceAgent::clearBrowserCookies(ErrorString*) | 505 void InspectorResourceAgent::clearBrowserCookies(ErrorString*) |
| 508 { | 506 { |
| 509 m_client->clearBrowserCookies(); | 507 m_client->clearBrowserCookies(); |
| 510 } | 508 } |
| 511 | 509 |
| 512 void InspectorResourceAgent::setCacheDisabled(ErrorString*, bool cacheDisabled) | 510 void InspectorResourceAgent::setCacheDisabled(ErrorString*, bool cacheDisabled) |
| 513 { | 511 { |
| 514 m_client->setCacheDisabled(cacheDisabled); | |
| 515 m_state->setBoolean(ResourceAgentState::cacheDisabled, cacheDisabled); | 512 m_state->setBoolean(ResourceAgentState::cacheDisabled, cacheDisabled); |
| 516 } | 513 } |
| 517 | 514 |
| 518 void InspectorResourceAgent::mainFrameNavigated(DocumentLoader* loader) | 515 void InspectorResourceAgent::mainFrameNavigated(DocumentLoader* loader) |
| 519 { | 516 { |
| 517 if (m_state->getBoolean(ResourceAgentState::cacheDisabled)) |
| 518 memoryCache()->evictResources(); |
| 519 |
| 520 m_resourcesData->clear(m_pageAgent->loaderId(loader)); | 520 m_resourcesData->clear(m_pageAgent->loaderId(loader)); |
| 521 } | 521 } |
| 522 | 522 |
| 523 InspectorResourceAgent::InspectorResourceAgent(InstrumentingAgents* instrumentin
gAgents, InspectorPageAgent* pageAgent, InspectorClient* client, InspectorState*
state) | 523 InspectorResourceAgent::InspectorResourceAgent(InstrumentingAgents* instrumentin
gAgents, InspectorPageAgent* pageAgent, InspectorClient* client, InspectorState*
state) |
| 524 : m_instrumentingAgents(instrumentingAgents) | 524 : m_instrumentingAgents(instrumentingAgents) |
| 525 , m_pageAgent(pageAgent) | 525 , m_pageAgent(pageAgent) |
| 526 , m_client(client) | 526 , m_client(client) |
| 527 , m_state(state) | 527 , m_state(state) |
| 528 , m_resourcesData(adoptPtr(new NetworkResourcesData())) | 528 , m_resourcesData(adoptPtr(new NetworkResourcesData())) |
| 529 , m_loadingXHRSynchronously(false) | 529 , m_loadingXHRSynchronously(false) |
| 530 { | 530 { |
| 531 if (isBackgroundEventsCollectionEnabled()) { | 531 if (isBackgroundEventsCollectionEnabled()) { |
| 532 initializeBackgroundCollection(); | 532 initializeBackgroundCollection(); |
| 533 // Create mock frontend, so we can collect network events. | 533 // Create mock frontend, so we can collect network events. |
| 534 m_frontend = m_mockFrontend.get(); | 534 m_frontend = m_mockFrontend.get(); |
| 535 enable(); | 535 enable(); |
| 536 } else | 536 } else |
| 537 m_frontend = 0; | 537 m_frontend = 0; |
| 538 } | 538 } |
| 539 | 539 |
| 540 } // namespace WebCore | 540 } // namespace WebCore |
| 541 | 541 |
| 542 #endif // ENABLE(INSPECTOR) | 542 #endif // ENABLE(INSPECTOR) |
| OLD | NEW |