| OLD | NEW |
| (Empty) |
| 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 | |
| 3 // found in the LICENSE file. | |
| 4 | |
| 5 #include "sky/engine/core/app/AbstractModule.h" | |
| 6 | |
| 7 #include "sky/engine/core/app/Module.h" | |
| 8 | |
| 9 namespace blink { | |
| 10 | |
| 11 AbstractModule::AbstractModule(ExecutionContext* context, | |
| 12 PassRefPtr<Document> document, | |
| 13 const String& url) | |
| 14 : ContextLifecycleObserver(context), | |
| 15 document_(document), | |
| 16 url_(url) { | |
| 17 document_->setModule(this); | |
| 18 } | |
| 19 | |
| 20 AbstractModule::~AbstractModule() { | |
| 21 document_->setModule(nullptr); | |
| 22 } | |
| 23 | |
| 24 void AbstractModule::AddLibrary(RefPtr<DartValue> library, | |
| 25 TextPosition position) { | |
| 26 libraries_.append(LibraryEntry(library, position)); | |
| 27 } | |
| 28 | |
| 29 String AbstractModule::UrlForLibraryAt(TextPosition position) { | |
| 30 // TODO(eseidel): This could produce invalid urls? | |
| 31 // TODO(abarth): Mangle these library names to they're not predictable. | |
| 32 // Otherwise you could 'import url.sky' in dart and it could magically work! | |
| 33 int line = position.m_line.zeroBasedInt(); | |
| 34 int column = position.m_column.zeroBasedInt(); | |
| 35 return url() + String::format("#l%d,c%d", line, column); | |
| 36 } | |
| 37 | |
| 38 ExecutionContext* AbstractModule::executionContext() const { | |
| 39 return ContextLifecycleObserver::executionContext(); | |
| 40 } | |
| 41 | |
| 42 } // namespace blink | |
| OLD | NEW |