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

Unified Diff: Source/core/inspector/InspectorFrontendHost.cpp

Issue 23702040: Send synchronous loads through the cache. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Address comments Created 7 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « Source/core/fetch/ResourceLoaderOptions.h ('k') | Source/core/inspector/InspectorInstrumentation.idl » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/core/inspector/InspectorFrontendHost.cpp
diff --git a/Source/core/inspector/InspectorFrontendHost.cpp b/Source/core/inspector/InspectorFrontendHost.cpp
index c4b6fbcc5f79bcad10d92d56303f98dc5505b4c2..a8e0d6b269dd98f2a19833a28e53c53c968f9eeb 100644
--- a/Source/core/inspector/InspectorFrontendHost.cpp
+++ b/Source/core/inspector/InspectorFrontendHost.cpp
@@ -45,6 +45,7 @@
#include "core/platform/ContextMenuItem.h"
#include "core/platform/JSONValues.h"
#include "core/platform/Pasteboard.h"
+#include "core/platform/SharedBuffer.h"
#include "core/platform/network/ResourceError.h"
#include "core/platform/network/ResourceRequest.h"
#include "core/platform/network/ResourceResponse.h"
@@ -218,21 +219,19 @@ void InspectorFrontendHost::showContextMenu(Event* event, const Vector<ContextMe
String InspectorFrontendHost::loadResourceSynchronously(const String& url)
{
- ResourceRequest request(url);
- request.setHTTPMethod("GET");
-
- Vector<char> data;
- ResourceError error;
- ResourceResponse response;
- m_frontendPage->mainFrame()->document()->fetcher()->fetchSynchronously(request, DoNotAllowStoredCredentials, error, response, data);
- WTF::TextEncoding textEncoding(response.textEncodingName());
+ FetchRequest request(url, FetchInitiatorInfo());
+ ResourcePtr<Resource> resource = m_frontendPage->mainFrame()->document()->fetcher()->fetchSynchronously(request);
+ if (!resource)
+ return emptyString();
+ WTF::TextEncoding textEncoding(resource->response().textEncodingName());
bool useDetector = false;
if (!textEncoding.isValid()) {
textEncoding = UTF8Encoding();
useDetector = true;
}
RefPtr<TextResourceDecoder> decoder = TextResourceDecoder::create("text/plain", textEncoding, useDetector);
- return decoder->decode(data.data(), data.size()) + decoder->flush();
+ SharedBuffer* data = resource->resourceBuffer();
+ return decoder->decode(data->data(), data->size()) + decoder->flush();
}
String InspectorFrontendHost::getSelectionBackgroundColor()
« no previous file with comments | « Source/core/fetch/ResourceLoaderOptions.h ('k') | Source/core/inspector/InspectorInstrumentation.idl » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698