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 1407 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1418 // have per-frame override instead. | 1418 // have per-frame override instead. |
1419 if (offline || latency || downloadThroughput || uploadThroughput) | 1419 if (offline || latency || downloadThroughput || uploadThroughput) |
1420 networkStateNotifier().setOverride(!offline, type, | 1420 networkStateNotifier().setOverride(!offline, type, |
1421 downloadThroughput / (1024 * 1024 / 8)); | 1421 downloadThroughput / (1024 * 1024 / 8)); |
1422 else | 1422 else |
1423 networkStateNotifier().clearOverride(); | 1423 networkStateNotifier().clearOverride(); |
1424 return Response::OK(); | 1424 return Response::OK(); |
1425 } | 1425 } |
1426 | 1426 |
1427 Response InspectorNetworkAgent::setCacheDisabled(bool cacheDisabled) { | 1427 Response InspectorNetworkAgent::setCacheDisabled(bool cacheDisabled) { |
| 1428 // TODO(ananta) |
| 1429 // We should extract network cache state into a global entity which can be |
| 1430 // queried from FrameLoader and other places. |
1428 m_state->setBoolean(NetworkAgentState::cacheDisabled, cacheDisabled); | 1431 m_state->setBoolean(NetworkAgentState::cacheDisabled, cacheDisabled); |
1429 if (cacheDisabled) | 1432 if (cacheDisabled) |
1430 memoryCache()->evictResources(); | 1433 memoryCache()->evictResources(); |
1431 return Response::OK(); | 1434 return Response::OK(); |
1432 } | 1435 } |
1433 | 1436 |
1434 Response InspectorNetworkAgent::setBypassServiceWorker(bool bypass) { | 1437 Response InspectorNetworkAgent::setBypassServiceWorker(bool bypass) { |
1435 m_state->setBoolean(NetworkAgentState::bypassServiceWorker, bypass); | 1438 m_state->setBoolean(NetworkAgentState::bypassServiceWorker, bypass); |
1436 return Response::OK(); | 1439 return Response::OK(); |
1437 } | 1440 } |
(...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1505 for (auto& resource : m_resourcesData->resources()) { | 1508 for (auto& resource : m_resourcesData->resources()) { |
1506 if (resource->requestedURL() == url) { | 1509 if (resource->requestedURL() == url) { |
1507 *content = resource->content(); | 1510 *content = resource->content(); |
1508 *base64Encoded = resource->base64Encoded(); | 1511 *base64Encoded = resource->base64Encoded(); |
1509 return true; | 1512 return true; |
1510 } | 1513 } |
1511 } | 1514 } |
1512 return false; | 1515 return false; |
1513 } | 1516 } |
1514 | 1517 |
| 1518 bool InspectorNetworkAgent::cacheDisabled() { |
| 1519 return m_state->booleanProperty(NetworkAgentState::networkAgentEnabled, |
| 1520 false) && |
| 1521 m_state->booleanProperty(NetworkAgentState::cacheDisabled, false); |
| 1522 } |
| 1523 |
1515 void InspectorNetworkAgent::removeFinishedReplayXHRFired(TimerBase*) { | 1524 void InspectorNetworkAgent::removeFinishedReplayXHRFired(TimerBase*) { |
1516 m_replayXHRsToBeDeleted.clear(); | 1525 m_replayXHRsToBeDeleted.clear(); |
1517 } | 1526 } |
1518 | 1527 |
1519 InspectorNetworkAgent::InspectorNetworkAgent(InspectedFrames* inspectedFrames) | 1528 InspectorNetworkAgent::InspectorNetworkAgent(InspectedFrames* inspectedFrames) |
1520 : m_inspectedFrames(inspectedFrames), | 1529 : m_inspectedFrames(inspectedFrames), |
1521 m_resourcesData(NetworkResourcesData::create(maximumTotalBufferSize, | 1530 m_resourcesData(NetworkResourcesData::create(maximumTotalBufferSize, |
1522 maximumResourceBufferSize)), | 1531 maximumResourceBufferSize)), |
1523 m_pendingRequest(nullptr), | 1532 m_pendingRequest(nullptr), |
1524 m_isRecalculatingStyle(false), | 1533 m_isRecalculatingStyle(false), |
1525 m_removeFinishedReplayXHRTimer( | 1534 m_removeFinishedReplayXHRTimer( |
1526 this, | 1535 this, |
1527 &InspectorNetworkAgent::removeFinishedReplayXHRFired) {} | 1536 &InspectorNetworkAgent::removeFinishedReplayXHRFired) {} |
1528 | 1537 |
1529 bool InspectorNetworkAgent::shouldForceCORSPreflight() { | 1538 bool InspectorNetworkAgent::shouldForceCORSPreflight() { |
1530 return m_state->booleanProperty(NetworkAgentState::cacheDisabled, false); | 1539 return m_state->booleanProperty(NetworkAgentState::cacheDisabled, false); |
1531 } | 1540 } |
1532 | 1541 |
1533 } // namespace blink | 1542 } // namespace blink |
OLD | NEW |