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

Unified Diff: sdk/lib/js/dartium/js_dartium.dart

Issue 1898163002: Generate cached_patches.dart using new Dartium swtich (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Created 4 years, 8 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 | « sdk/lib/js/dartium/cached_patches.dart ('k') | tools/dartium/generate_app/generate_cached_patches.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: sdk/lib/js/dartium/js_dartium.dart
diff --git a/sdk/lib/js/dartium/js_dartium.dart b/sdk/lib/js/dartium/js_dartium.dart
index 0d964257af0a2cf5af244cc90e5ea37edc875710..97e927ebffab4c9e3b9326f638f37914f9f59c82 100644
--- a/sdk/lib/js/dartium/js_dartium.dart
+++ b/sdk/lib/js/dartium/js_dartium.dart
@@ -282,48 +282,6 @@ void _registerJsInterfaces(List<Type> classes) {
_finalizeJsInterfaces() native "Js_finalizeJsInterfaces";
-// Create the files for the generated Dart files from IDLs. These only change
-// when browser's Dart files change (dart:*).
-@Deprecated("Internal Use Only")
-String createCachedPatchesFile() {
- var patches = _generateInteropPatchFiles(['dart:html',
- 'dart:indexed_db',
- 'dart:web_gl',
- 'dart:web_sql',
- 'dart:svg',
- 'dart:web_audio']);
- var sb = new StringBuffer();
-
- sb.write("""
-
-// START_OF_CACHED_PATCHES
-// Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file
-// for details. All rights reserved. Use of this source code is governed by a
-// BSD-style license that can be found in the LICENSE file.
-
-// DO NOT EDIT GENERATED FILE.
-
-library cached_patches;
-
-var cached_patches = {""");
-
- for (var baseIndex = 0; baseIndex < patches.length; baseIndex += 3) {
- var uri = patches[baseIndex + 0];
- var uri_js_interop = patches[baseIndex + 1];
- var source = patches[baseIndex + 2];
-
- if (uri != 'dart:js') {
- sb.write('"$uri": ["$uri", "$uri_js_interop", """$source"""],');
- }
- }
-
- sb.write("""};
-// END_OF_CACHED_PATCHES
- """);
-
- return "$sb";
-}
-
String _getJsName(mirrors.DeclarationMirror mirror) {
if (_atJsType != null) {
for (var annotation in mirror.metadata) {
@@ -499,19 +457,23 @@ bool _isExternal(mirrors.MethodMirror mirror) {
return false;
}
-List<String> _generateExternalMethods(List<String> libraryPaths) {
+List<String> _generateExternalMethods(List<String> libraryPaths, bool useCachedPatches) {
var staticCodegen = <String>[];
if (libraryPaths.length == 0) {
mirrors.currentMirrorSystem().libraries.forEach((uri, library) {
var library_name = "${uri.scheme}:${uri.path}";
- if (cached_patches.containsKey(library_name)) {
+ if (useCachedPatches && cached_patches.containsKey(library_name)) {
// Use the pre-generated patch files for DOM dart:nnnn libraries.
var patch = cached_patches[library_name];
staticCodegen.addAll(patch);
} else if (_hasJsName(library)) {
// Library marked with @JS
_generateLibraryCodegen(uri, library, staticCodegen);
+ } else if (!useCachedPatches) {
+ // Can't use the cached patches file, instead this is a signal to generate
+ // the patches for this file.
+ _generateLibraryCodegen(uri, library, staticCodegen);
}
}); // End of library foreach
} else {
@@ -676,8 +638,11 @@ var _atJsType = -1;
* Generates part files defining source code for JSObjectImpl, all DOM classes
* classes. This codegen is needed so that type checks for all registered
* JavaScript interop classes pass.
+ * If genCachedPatches is true then the patch files don't exist this is a special
+ * signal to generate and emit the patches to stdout to be captured and put into
+ * the file sdk/lib/js/dartium/cached_patches.dart
*/
-List<String> _generateInteropPatchFiles(List<String> libraryPaths) {
+List<String> _generateInteropPatchFiles(List<String> libraryPaths, genCachedPatches) {
// Cache the @JS Type.
if (_atJsType == -1) {
var uri = new Uri(scheme: "package", path: "js/js.dart");
@@ -692,7 +657,7 @@ List<String> _generateInteropPatchFiles(List<String> libraryPaths) {
}
}
- var ret = _generateExternalMethods(libraryPaths);
+ var ret = _generateExternalMethods(libraryPaths, genCachedPatches ? false : true);
var libraryPrefixes = new Map<mirrors.LibraryMirror, String>();
var prefixNames = new Set<String>();
var sb = new StringBuffer();
« no previous file with comments | « sdk/lib/js/dartium/cached_patches.dart ('k') | tools/dartium/generate_app/generate_cached_patches.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698