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

Unified Diff: sky/engine/core/app/ModuleLoader.cpp

Issue 922893002: Merge the Sky Engine changes from the SkyDart branch (Closed) Base URL: git@github.com:domokit/mojo.git@master
Patch Set: Created 5 years, 10 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 | « sky/engine/core/app/ModuleLoader.h ('k') | sky/engine/core/core.gni » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: sky/engine/core/app/ModuleLoader.cpp
diff --git a/sky/engine/core/app/ModuleLoader.cpp b/sky/engine/core/app/ModuleLoader.cpp
deleted file mode 100644
index b7428b25c2fa2a3713486e80060a355cfac6de08..0000000000000000000000000000000000000000
--- a/sky/engine/core/app/ModuleLoader.cpp
+++ /dev/null
@@ -1,65 +0,0 @@
-// Copyright 2014 The Chromium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-#include "sky/engine/config.h"
-#include "sky/engine/core/app/ModuleLoader.h"
-
-#include "base/bind.h"
-#include "sky/engine/core/app/Application.h"
-#include "sky/engine/core/app/Module.h"
-#include "sky/engine/core/dom/Document.h"
-#include "sky/engine/core/dom/DocumentParser.h"
-#include "sky/engine/wtf/text/WTFString.h"
-
-namespace blink {
-
-ModuleLoader::Client::~Client() {
-}
-
-ModuleLoader::ModuleLoader(Client* client,
- Application* application,
- const KURL& url)
- : state_(LOADING),
- client_(client),
- application_(application),
- fetcher_(adoptPtr(new MojoFetcher(this, url))),
- weak_factory_(this) {
-}
-
-ModuleLoader::~ModuleLoader() {
-}
-
-void ModuleLoader::OnReceivedResponse(mojo::URLResponsePtr response) {
- if (response->error || response->status_code >= 400) {
- String message = String::format(
- "Failed to load resource: Server responded with a status of %d (%s)",
- response->status_code, response->status_line.data());
- RefPtr<ConsoleMessage> consoleMessage = ConsoleMessage::create(
- NetworkMessageSource, ErrorMessageLevel, message, response->url.data());
- application_->document()->addMessage(consoleMessage);
- state_ = COMPLETE;
- client_->OnModuleLoadComplete(this, nullptr);
- return;
- }
-
- WeakPtr<Document> context = application_->document()->contextDocument();
- ASSERT(context.get());
- KURL url(ParsedURLString, String::fromUTF8(response->url));
- DocumentInit init = DocumentInit(url, 0, context, 0)
- .withRegistrationContext(context->registrationContext());
-
- RefPtr<Document> document = Document::create(init);
- document->startParsing()->parse(response->body.Pass(),
- base::Bind(&ModuleLoader::OnParsingComplete, weak_factory_.GetWeakPtr()));
-
- module_ = Module::create(
- context.get(), application_, document.release(), url.string());
-}
-
-void ModuleLoader::OnParsingComplete() {
- state_ = COMPLETE;
- client_->OnModuleLoadComplete(this, module_.get());
-}
-
-} // namespace blink
« no previous file with comments | « sky/engine/core/app/ModuleLoader.h ('k') | sky/engine/core/core.gni » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698