OLD | NEW |
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 "base/bind.h" | 5 #include "base/bind.h" |
6 #include "base/callback.h" | 6 #include "base/callback.h" |
7 #include "base/files/file_util.h" | 7 #include "base/files/file_util.h" |
8 #include "base/logging.h" | 8 #include "base/logging.h" |
9 #include "base/path_service.h" | 9 #include "base/path_service.h" |
10 #include "base/rand_util.h" | 10 #include "base/rand_util.h" |
(...skipping 246 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
257 // whereas above we do want to bring the whole process down for a bug in | 257 // whereas above we do want to bring the whole process down for a bug in |
258 // library or generated code. | 258 // library or generated code. |
259 return tonic::LogIfError(result); | 259 return tonic::LogIfError(result); |
260 } | 260 } |
261 | 261 |
262 Dart_Handle DartController::LibraryTagHandler(Dart_LibraryTag tag, | 262 Dart_Handle DartController::LibraryTagHandler(Dart_LibraryTag tag, |
263 Dart_Handle library, | 263 Dart_Handle library, |
264 Dart_Handle url) { | 264 Dart_Handle url) { |
265 if (tag == Dart_kCanonicalizeUrl) { | 265 if (tag == Dart_kCanonicalizeUrl) { |
266 std::string string = tonic::StdStringFromDart(url); | 266 std::string string = tonic::StdStringFromDart(url); |
267 if (StartsWithASCII(string, "dart:", true)) | 267 if (base::StartsWith(string, "dart:", base::CompareCase::SENSITIVE)) |
268 return url; | 268 return url; |
269 } | 269 } |
270 return tonic::DartLibraryLoader::HandleLibraryTag(tag, library, url); | 270 return tonic::DartLibraryLoader::HandleLibraryTag(tag, library, url); |
271 } | 271 } |
272 | 272 |
273 Dart_Isolate DartController::CreateIsolateHelper( | 273 Dart_Isolate DartController::CreateIsolateHelper( |
274 void* dart_app, | 274 void* dart_app, |
275 Dart_IsolateFlags* flags, | 275 Dart_IsolateFlags* flags, |
276 IsolateCallbacks callbacks, | 276 IsolateCallbacks callbacks, |
277 std::string script_uri, | 277 std::string script_uri, |
(...skipping 166 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
444 void* callback_data, | 444 void* callback_data, |
445 char** error) { | 445 char** error) { |
446 DCHECK(script_uri != nullptr); | 446 DCHECK(script_uri != nullptr); |
447 auto parent_isolate_data = MojoDartState::Cast(callback_data); | 447 auto parent_isolate_data = MojoDartState::Cast(callback_data); |
448 std::string script_uri_string(script_uri); | 448 std::string script_uri_string(script_uri); |
449 std::string package_root_string; | 449 std::string package_root_string; |
450 std::string base_uri_string; | 450 std::string base_uri_string; |
451 | 451 |
452 // If it's a file URI, strip the scheme. | 452 // If it's a file URI, strip the scheme. |
453 const char* file_scheme = "file://"; | 453 const char* file_scheme = "file://"; |
454 if (StartsWithASCII(script_uri_string, file_scheme, true)) { | 454 if (base::StartsWith(script_uri_string, file_scheme, |
| 455 base::CompareCase::SENSITIVE)) { |
455 script_uri_string = script_uri_string.substr(strlen(file_scheme)); | 456 script_uri_string = script_uri_string.substr(strlen(file_scheme)); |
456 } | 457 } |
457 | 458 |
458 if ((parent_isolate_data != nullptr) && | 459 if ((parent_isolate_data != nullptr) && |
459 (parent_isolate_data->script_uri() == script_uri_string)) { | 460 (parent_isolate_data->script_uri() == script_uri_string)) { |
460 // We are spawning a function, use the parent isolate's base URI. | 461 // We are spawning a function, use the parent isolate's base URI. |
461 base_uri_string = parent_isolate_data->base_uri(); | 462 base_uri_string = parent_isolate_data->base_uri(); |
462 } else { | 463 } else { |
463 // If we are spawning a URI directly, use the URI as the base URI. | 464 // If we are spawning a URI directly, use the URI as the base URI. |
464 base_uri_string = std::string(script_uri); | 465 base_uri_string = std::string(script_uri); |
(...skipping 283 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
748 } | 749 } |
749 BlockForServiceIsolateLocked(); | 750 BlockForServiceIsolateLocked(); |
750 HandleWatcher::StopAll(); | 751 HandleWatcher::StopAll(); |
751 Dart_Cleanup(); | 752 Dart_Cleanup(); |
752 service_isolate_running_ = false; | 753 service_isolate_running_ = false; |
753 initialized_ = false; | 754 initialized_ = false; |
754 } | 755 } |
755 | 756 |
756 } // namespace apps | 757 } // namespace apps |
757 } // namespace mojo | 758 } // namespace mojo |
OLD | NEW |