Commit c5b03f66 authored by Pavel Feldman's avatar Pavel Feldman Committed by Commit Bot

DevTools: do not produce compilation cache for inspector if it is already there.

Change-Id: I28d083c3dbb6bacb7d8252eaa32c033a310a4124
Reviewed-on: https://chromium-review.googlesource.com/1157212
Commit-Queue: Pavel Feldman <pfeldman@chromium.org>
Reviewed-by: default avatarAndrey Kosyakov <caseq@chromium.org>
Cr-Commit-Position: refs/heads/master@{#580044}
parent 63af8d5f
...@@ -1259,6 +1259,10 @@ void InspectorPageAgent::ProduceCompilationCache(const ScriptSourceCode& source, ...@@ -1259,6 +1259,10 @@ void InspectorPageAgent::ProduceCompilationCache(const ScriptSourceCode& source,
return; return;
if (url.IsEmpty()) if (url.IsEmpty())
return; return;
String url_string = url.GetString();
auto it = compilation_cache_.find(url_string);
if (it != compilation_cache_.end())
return;
static const int kMinimalCodeLength = 1024; static const int kMinimalCodeLength = 1024;
if (source.Source().length() < kMinimalCodeLength) if (source.Source().length() < kMinimalCodeLength)
return; return;
...@@ -1267,7 +1271,7 @@ void InspectorPageAgent::ProduceCompilationCache(const ScriptSourceCode& source, ...@@ -1267,7 +1271,7 @@ void InspectorPageAgent::ProduceCompilationCache(const ScriptSourceCode& source,
if (cached_data) { if (cached_data) {
String base64data = Base64Encode( String base64data = Base64Encode(
reinterpret_cast<const char*>(cached_data->data), cached_data->length); reinterpret_cast<const char*>(cached_data->data), cached_data->length);
GetFrontend()->compilationCacheProduced(url, base64data); GetFrontend()->compilationCacheProduced(url_string, base64data);
} }
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment