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

Side by Side Diff: Source/bindings/dart/DartAsyncLoader.cpp

Issue 428783004: Pass line offsets to Dart_LoadLibrary and Dart_LoadSource. (Closed) Base URL: svn://svn.chromium.org/blink/branches/dart/dartium
Patch Set: Created 6 years, 4 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 | Annotate | Revision Log
« no previous file with comments | « Source/bindings/dart/DartAsyncLoader.h ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2013, Google Inc. 1 // Copyright (c) 2013, Google Inc.
2 // All rights reserved. 2 // All rights reserved.
3 // 3 //
4 // Redistribution and use in source and binary forms, with or without 4 // Redistribution and use in source and binary forms, with or without
5 // modification, are permitted provided that the following conditions are 5 // modification, are permitted provided that the following conditions are
6 // met: 6 // met:
7 // 7 //
8 // * Redistributions of source code must retain the above copyright 8 // * Redistributions of source code must retain the above copyright
9 // notice, this list of conditions and the following disclaimer. 9 // notice, this list of conditions and the following disclaimer.
10 // * Redistributions in binary form must reproduce the above 10 // * Redistributions in binary form must reproduce the above
(...skipping 220 matching lines...) Expand 10 before | Expand all | Expand 10 after
231 231
232 DartIsolateScope isolateScope(m_isolate); 232 DartIsolateScope isolateScope(m_isolate);
233 DartApiScope dartApiScope; 233 DartApiScope dartApiScope;
234 234
235 if (scriptUrl() == url) { 235 if (scriptUrl() == url) {
236 ASSERT(!m_mainScriptFetched); 236 ASSERT(!m_mainScriptFetched);
237 m_mainScriptFetched = true; 237 m_mainScriptFetched = true;
238 } 238 }
239 239
240 if (m_pendingLibraries.contains(url)) { 240 if (m_pendingLibraries.contains(url)) {
241 processLibrary(url, source); 241 processLibrary(url, source, lineNumber);
242 } else { 242 } else {
243 ASSERT(m_pendingSource.contains(url)); 243 ASSERT(m_pendingSource.contains(url));
244 processSource(url, source); 244 processSource(url, source, lineNumber);
245 } 245 }
246 } 246 }
247 247
248 void DartAsyncLoader::reportError(Dart_Handle error, const String& url) 248 void DartAsyncLoader::reportError(Dart_Handle error, const String& url)
249 { 249 {
250 reportError(Dart_GetError(error), url); 250 reportError(Dart_GetError(error), url);
251 } 251 }
252 252
253 void DartAsyncLoader::reportError(const String& error, const String& url) 253 void DartAsyncLoader::reportError(const String& error, const String& url)
254 { 254 {
255 m_error = true; 255 m_error = true;
256 m_loadCallback->reportError(error, url); 256 m_loadCallback->reportError(error, url);
257 } 257 }
258 258
259 259
260 void DartAsyncLoader::processLibrary(const String& url, const String& source) 260 void DartAsyncLoader::processLibrary(const String& url, const String& source, in tptr_t lineNumber)
261 { 261 {
262 ASSERT(m_pendingLibraries.contains(url)); 262 ASSERT(m_pendingLibraries.contains(url));
263 263
264 Dart_Handle result; 264 Dart_Handle result;
265 if (!m_rootLoaded) { 265 if (!m_rootLoaded) {
266 // A spawned isolate. 266 // A spawned isolate.
267 m_rootLoaded = true; 267 m_rootLoaded = true;
268 result = Dart_LoadScript(DartUtilities::stringToDartString(url), DartUti lities::convertSourceString(source), 0, 0); 268 result = Dart_LoadScript(DartUtilities::stringToDartString(url), DartUti lities::convertSourceString(source), lineNumber, 0);
269 } else { 269 } else {
270 result = Dart_LoadLibrary(DartUtilities::stringToDartString(url), DartUt ilities::convertSourceString(source)); 270 result = Dart_LoadLibrary(DartUtilities::stringToDartString(url), DartUt ilities::convertSourceString(source), lineNumber, 0);
271 } 271 }
272 if (Dart_IsError(result)) 272 if (Dart_IsError(result))
273 reportError(result, url); 273 reportError(result, url);
274 274
275 m_pendingLibraries.remove(url); 275 m_pendingLibraries.remove(url);
276 } 276 }
277 277
278 void DartAsyncLoader::processSource(const String& url, const String& source) 278 void DartAsyncLoader::processSource(const String& url, const String& source, int ptr_t lineNumber)
279 { 279 {
280 ASSERT(m_pendingSource.contains(url)); 280 ASSERT(m_pendingSource.contains(url));
281 HandleSet* importers = m_pendingSource.take(url); 281 HandleSet* importers = m_pendingSource.take(url);
282 for (HandleSet::iterator i = importers->begin(); i != importers->end(); ++i) { 282 for (HandleSet::iterator i = importers->begin(); i != importers->end(); ++i) {
283 Dart_Handle persistent = *i; 283 Dart_Handle persistent = *i;
284 Dart_Handle library = Dart_HandleFromPersistent(persistent); 284 Dart_Handle library = Dart_HandleFromPersistent(persistent);
285 Dart_DeletePersistentHandle(persistent); 285 Dart_DeletePersistentHandle(persistent);
286 286
287 Dart_Handle result = Dart_LoadSource(library, DartUtilities::stringToDar tString(url), DartUtilities::convertSourceString(source)); 287 Dart_Handle result = Dart_LoadSource(library, DartUtilities::stringToDar tString(url), DartUtilities::convertSourceString(source), lineNumber, 0);
288 if (Dart_IsError(result)) 288 if (Dart_IsError(result))
289 reportError(result, url); 289 reportError(result, url);
290 } 290 }
291 delete importers; 291 delete importers;
292 } 292 }
293 293
294 void DartAsyncLoader::process(const String& url, const String& source, intptr_t lineNumber) 294 void DartAsyncLoader::process(const String& url, const String& source, intptr_t lineNumber)
295 { 295 {
296 findDependences(url, source, lineNumber); 296 findDependences(url, source, lineNumber);
297 if (ready()) { 297 if (ready()) {
(...skipping 127 matching lines...) Expand 10 before | Expand all | Expand 10 after
425 ResourcePtr<ScriptResource> scriptResource = m_loadCallback->requestScript(r equest); 425 ResourcePtr<ScriptResource> scriptResource = m_loadCallback->requestScript(r equest);
426 if (scriptResource) { 426 if (scriptResource) {
427 scriptResource->addClient(new ScriptLoadedCallback(m_loadCallback->compl eteURL(url), this, scriptResource)); 427 scriptResource->addClient(new ScriptLoadedCallback(m_loadCallback->compl eteURL(url), this, scriptResource));
428 } else { 428 } else {
429 m_error = true; 429 m_error = true;
430 m_loadCallback->reportError(String("File request error"), url); 430 m_loadCallback->reportError(String("File request error"), url);
431 } 431 }
432 } 432 }
433 433
434 } 434 }
OLDNEW
« no previous file with comments | « Source/bindings/dart/DartAsyncLoader.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698