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

Unified Diff: Source/WebCore/bindings/dart/gyp/scripts/build_dart_snapshot.py

Issue 9188009: Things to unfork. (Closed) Base URL: svn://svn.chromium.org/multivm/trunk/webkit
Patch Set: Created 8 years, 11 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
Index: Source/WebCore/bindings/dart/gyp/scripts/build_dart_snapshot.py
diff --git a/Source/WebCore/bindings/dart/gyp/scripts/build_dart_snapshot.py b/Source/WebCore/bindings/dart/gyp/scripts/build_dart_snapshot.py
deleted file mode 100644
index 74b5e8105408ad659ebdd0798cb00f32bade66cd..0000000000000000000000000000000000000000
--- a/Source/WebCore/bindings/dart/gyp/scripts/build_dart_snapshot.py
+++ /dev/null
@@ -1,218 +0,0 @@
-#!/usr/bin/python
-#
-# Copyright (C) 2011 Google Inc. All rights reserved.
-#
-# Redistribution and use in source and binary forms, with or without
-# modification, are permitted provided that the following conditions are
-# met:
-#
-# * Redistributions of source code must retain the above copyright
-# notice, this list of conditions and the following disclaimer.
-# * Redistributions in binary form must reproduce the above
-# copyright notice, this list of conditions and the following disclaimer
-# in the documentation and/or other materials provided with the
-# distribution.
-# * Neither the name of Google Inc. nor the names of its
-# contributors may be used to endorse or promote products derived from
-# this software without specific prior written permission.
-#
-# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-#
-# Copyright (c) 2011 The Chromium Authors. All rights reserved.
-# Use of this source code is governed by a BSD-style license that can be
-# found in the LICENSE file.
-
-# build_dart_snapshot.py generates two C++ files: DartSnapshot.cpp
-# with a constant which is a snapshot of major DOM libs an
-# DartResolver.cpp which is a resolver for dart:domimpl library.
-
-import os.path
-import subprocess
-import sys
-
-copyrightTemplate = """/*
- * THIS FILE WAS AUTOMATICALLY GENERATED, DO NOT EDIT.
- *
- * Copyright (C) 2011 Google Inc. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY
- * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
- * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR
- * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
- * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
- * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
- * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
- * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
- * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-"""
-
-
-def main(args):
- assert(len(args) == 7)
- idlListFileName = args[1]
- dartPath = args[2]
- webkitDartResourcesPath = args[3]
- outputFilePath = args[4]
- genSnapshotBinPath = args[5]
-
- domCommonPath = os.path.relpath(os.path.join(dartPath, 'client', 'dom', 'common'), outputFilePath)
- webkitDartResourcesPath = os.path.relpath(webkitDartResourcesPath, outputFilePath)
-
- # FIXME: proper support of enabled features.
- EXCLUDED = [
- 'WebKitMutationObserver',
- 'WebKitCSSFilterValue',
- 'MutationRecord',
- 'HTMLDataListElement',
- 'HTMLPropertiesCollection',
- 'DOMWindowWebAudio',
- 'DOMWindowWebSocket',
- 'Intent',
- 'NavigatorGamepad',
- ]
-
- interfaceNames = []
- idlListFile = open(idlListFileName, 'r')
- for idlFileName in idlListFile:
- if not idlFileName:
- continue
- interfaceName = os.path.splitext(os.path.basename(idlFileName))[0]
- if interfaceName in EXCLUDED:
- continue
- interfaceNames.append(interfaceName)
- idlListFile.close()
-
- def write(name, template, **kwargs):
- f = open(os.path.join(outputFilePath, name), 'w')
- f.write(template % kwargs)
- f.close()
-
- def forAllInterfaces(s):
- return ''.join([s % interfaceName for interfaceName in interfaceNames])
-
- # Generate snapshot script.
- write('snapshot.dart', '''
-%(copyrightTemplate)s
-
-#import("dart:dom", prefix: "dom");
-#import("dart:html", prefix: "html");
-#import("dart:json", prefix: "json");
-''', copyrightTemplate=copyrightTemplate)
-
- # Generate dart:dom library.
- write('dom_public.dart', '''
-%(copyrightTemplate)s
-
-#library("DOM Library");
-
-#import("dart:domimpl");
-
-#source("%(domCommonPath)s/public.dart");
-#source("%(webkitDartResourcesPath)s/dom_public.dart");
-
-%(sources)s
-''', copyrightTemplate=copyrightTemplate,
- domCommonPath=domCommonPath,
- webkitDartResourcesPath=webkitDartResourcesPath,
- sources=forAllInterfaces('#source("%s.dart");\n'))
-
- # Generate dart:domimpl
- write('dom_implementation.dart', '''
-%(copyrightTemplate)s
-
-#library("DOM Implementation Library");
-
-#import("dart:coreimpl");
-#import("dart:dom");
-#import("dart:nativewrappers");
-
-#source("%(domCommonPath)s/implementation.dart");
-#source("%(webkitDartResourcesPath)s/dom_implementation.dart");
-
-%(sources)s
-
-class DOMWrapperBase extends NativeFieldWrapperClass2 {}
-''', copyrightTemplate=copyrightTemplate,
- domCommonPath=domCommonPath,
- webkitDartResourcesPath=webkitDartResourcesPath,
- sources=forAllInterfaces('#source("%sImplementation.dart");\n'))
-
- # Generate resolver.
- resolverClasses = ['Dart' + interfaceName for interfaceName in interfaceNames if not interfaceName.endswith('Callback')]
-
- def forAllClasses(s):
- return ''.join([s % className for className in resolverClasses])
-
- write('DartResolver.cpp', '''
-%(copyrightTemplate)s
-
-#include "config.h"
-%(includes)s
-
-namespace WebCore {
-
-Dart_NativeFunction snapshotResolver(Dart_Handle name, int argumentCount)
-{
-%(classChecks)s
- return 0;
-}
-
-}
-''', copyrightTemplate=copyrightTemplate,
- includes=forAllClasses('#include "%s.h"\n'),
- classChecks=forAllClasses('''
- if (Dart_NativeFunction func = %s::resolver(name, argumentCount))
- return func;
-'''))
-
- # Construct command line to execute the snapshot generator binary and invoke.
- def path(*components):
- return os.path.abspath(os.path.join(*components))
-
- command = [
- 'python',
- path(dartPath, 'runtime', 'tools', 'create_snapshot_file.py'),
- '--executable=%s' % path(genSnapshotBinPath),
- '--input_cc=%s' % path(outputFilePath, webkitDartResourcesPath, 'DartSnapshot.bytes.template'),
- '--output_bin=%s' % path(outputFilePath, 'DartSnapshot.bin'),
- '--output=%s' % path(outputFilePath, 'DartSnapshot.bytes'),
- '--script=%s' % path(outputFilePath, 'snapshot.dart'),
- '--url_mapping=dart:dom,%s' % path(outputFilePath, 'dom_public.dart'),
- '--url_mapping=dart:domimpl,%s' % path(outputFilePath, 'dom_implementation.dart'),
- '--url_mapping=dart:html,%s' % path(dartPath, 'client', 'html', 'release', 'html.dart'),
- '--url_mapping=dart:htmlimpl,%s' % path(dartPath, 'client', 'html', 'release', 'htmlimpl.dart'),
- '--url_mapping=dart:json,%s' % path(dartPath, 'client', 'json', 'dart_json.dart'),
- ]
- pipe = subprocess.Popen(command,
- stdout=subprocess.PIPE,
- stderr=subprocess.PIPE)
- out, error = pipe.communicate()
- if (pipe.returncode != 0):
- raise Exception('Snapshot generation failed: %s/%s' % (out, error))
-
- return 0
-
-if __name__ == '__main__':
- sys.exit(main(sys.argv))

Powered by Google App Engine
This is Rietveld 408576698