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

Side by Side Diff: sky/engine/core/app/ModuleLoader.cpp

Issue 871383002: Merge HTMLDocument into Document (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 unified diff | Download patch
« no previous file with comments | « sky/engine/bindings/templates/interface.cpp ('k') | sky/engine/core/core.gni » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "sky/engine/config.h" 5 #include "sky/engine/config.h"
6 #include "sky/engine/core/app/ModuleLoader.h" 6 #include "sky/engine/core/app/ModuleLoader.h"
7 7
8 #include "base/bind.h" 8 #include "base/bind.h"
9 #include "sky/engine/core/app/Application.h" 9 #include "sky/engine/core/app/Application.h"
10 #include "sky/engine/core/app/Module.h" 10 #include "sky/engine/core/app/Module.h"
11 #include "sky/engine/core/dom/Document.h" 11 #include "sky/engine/core/dom/Document.h"
12 #include "sky/engine/core/dom/DocumentParser.h" 12 #include "sky/engine/core/dom/DocumentParser.h"
13 #include "sky/engine/core/html/HTMLDocument.h"
14 #include "sky/engine/wtf/text/WTFString.h" 13 #include "sky/engine/wtf/text/WTFString.h"
15 14
16 namespace blink { 15 namespace blink {
17 16
18 ModuleLoader::Client::~Client() { 17 ModuleLoader::Client::~Client() {
19 } 18 }
20 19
21 ModuleLoader::ModuleLoader(Client* client, 20 ModuleLoader::ModuleLoader(Client* client,
22 Application* application, 21 Application* application,
23 const KURL& url) 22 const KURL& url)
(...skipping 19 matching lines...) Expand all
43 client_->OnModuleLoadComplete(this, nullptr); 42 client_->OnModuleLoadComplete(this, nullptr);
44 return; 43 return;
45 } 44 }
46 45
47 WeakPtr<Document> context = application_->document()->contextDocument(); 46 WeakPtr<Document> context = application_->document()->contextDocument();
48 ASSERT(context.get()); 47 ASSERT(context.get());
49 KURL url(ParsedURLString, String::fromUTF8(response->url)); 48 KURL url(ParsedURLString, String::fromUTF8(response->url));
50 DocumentInit init = DocumentInit(url, 0, context, 0) 49 DocumentInit init = DocumentInit(url, 0, context, 0)
51 .withRegistrationContext(context->registrationContext()); 50 .withRegistrationContext(context->registrationContext());
52 51
53 RefPtr<Document> document = HTMLDocument::create(init); 52 RefPtr<Document> document = Document::create(init);
54 document->startParsing()->parse(response->body.Pass(), 53 document->startParsing()->parse(response->body.Pass(),
55 base::Bind(&ModuleLoader::OnParsingComplete, weak_factory_.GetWeakPtr())); 54 base::Bind(&ModuleLoader::OnParsingComplete, weak_factory_.GetWeakPtr()));
56 55
57 module_ = Module::create( 56 module_ = Module::create(
58 context.get(), application_, document.release(), url.string()); 57 context.get(), application_, document.release(), url.string());
59 } 58 }
60 59
61 void ModuleLoader::OnParsingComplete() { 60 void ModuleLoader::OnParsingComplete() {
62 state_ = COMPLETE; 61 state_ = COMPLETE;
63 client_->OnModuleLoadComplete(this, module_.get()); 62 client_->OnModuleLoadComplete(this, module_.get());
64 } 63 }
65 64
66 } // namespace blink 65 } // namespace blink
OLDNEW
« no previous file with comments | « sky/engine/bindings/templates/interface.cpp ('k') | sky/engine/core/core.gni » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698