| Index: Source/WebCore/bindings/dart/DartApplicationLoader.cpp
|
| diff --git a/Source/WebCore/bindings/dart/DartApplicationLoader.cpp b/Source/WebCore/bindings/dart/DartApplicationLoader.cpp
|
| index edbf2f6a1412fa3fa87493cb17e88de94f58659f..a9df6551e0f9d157a0e57ba113a6b493a3dd7b4e 100644
|
| --- a/Source/WebCore/bindings/dart/DartApplicationLoader.cpp
|
| +++ b/Source/WebCore/bindings/dart/DartApplicationLoader.cpp
|
| @@ -40,6 +40,7 @@
|
| #include "DartUtilities.h"
|
| #include "Document.h"
|
| #include "Frame.h"
|
| +#include "InspectorInstrumentation.h"
|
| #include "ScriptCallStack.h"
|
| #include "ScriptSourceCode.h"
|
|
|
| @@ -47,6 +48,22 @@
|
|
|
| namespace WebCore {
|
|
|
| +class Timeline {
|
| +public:
|
| + Timeline(DartApplicationLoader* loader, String tag)
|
| + {
|
| + m_cookie = InspectorInstrumentation::willEvaluateScript(loader->m_document->frame(), tag + "@"+ loader->m_libraryUrl, 0);
|
| + }
|
| +
|
| + ~Timeline()
|
| + {
|
| + InspectorInstrumentation::didEvaluateScript(m_cookie);
|
| + }
|
| +
|
| +private:
|
| + InspectorInstrumentationCookie m_cookie;
|
| +};
|
| +
|
| DartApplicationLoader::DartApplicationLoader(Document* document)
|
| : m_document(document)
|
| , m_libraryUrl()
|
| @@ -84,7 +101,7 @@ void DartApplicationLoader::load(const String& url, const String& source)
|
| CachedResourceLoader* loader = m_document->cachedResourceLoader();
|
| ResourceRequest request(m_document->completeURL(mainLibraryURL()));
|
| CachedScript* cachedScript = loader->requestScript(request, "utf-8");
|
| - if (cachedScript && !cachedScript->cachedMetadata(dartTypeID)) {
|
| + if (true && cachedScript && !cachedScript->cachedMetadata(dartTypeID)) {
|
| uint8_t* buffer;
|
| intptr_t size;
|
| Dart_Handle result = Dart_CreateScriptSnapshot(&buffer, &size);
|
| @@ -95,6 +112,7 @@ void DartApplicationLoader::load(const String& url, const String& source)
|
| // Consider other options like Dart_CompileAll.
|
| return;
|
| }
|
| + printf("*** Creating a snapshot of size %d\n", size);
|
| cachedScript->setCachedMetadata(dartTypeID, reinterpret_cast<const char*>(buffer), size);
|
| }
|
|
|
| @@ -177,6 +195,7 @@ void DartApplicationLoader::loadScript(const String& url, const String& source)
|
|
|
| void DartApplicationLoader::loadScriptFromSnapshot(const String& url, const uint8_t* snapshot)
|
| {
|
| + Timeline timeline(this, "loadSnapshot");
|
| ASSERT(m_importedLibraries.isEmpty());
|
| ASSERT(m_importersForSource.isEmpty());
|
| m_libraryUrl = url;
|
| @@ -220,6 +239,7 @@ void DartApplicationLoader::loadLibrary(const String& url, const String& source)
|
|
|
| void DartApplicationLoader::callEntryPoint()
|
| {
|
| + Timeline timeline(this, "callEntryPoint");
|
| ASSERT(m_document->readyState() != "loading");
|
| Dart_Handle result = Dart_InvokeStatic(topLevelLibrary(), Dart_NewString(""), Dart_NewString("main"), 0, 0);
|
| if (Dart_IsError(result))
|
| @@ -264,6 +284,7 @@ public:
|
| ScriptSourceCode sourceCode(m_cachedScript.get());
|
| DartIsolateState::Scope scope(m_isolate);
|
| CachedMetadata* cachedMetadata = m_cachedScript->cachedMetadata(dartTypeID);
|
| + printf("*** cachedMetadata: %p for %s\n", cachedMetadata, sourceCode.url().string().ascii().data());
|
| if (cachedMetadata)
|
| m_loader->loadScriptFromSnapshot(sourceCode.url(), reinterpret_cast<const uint8_t*>(cachedMetadata->data()));
|
| else
|
|
|