diff options
author | caitkp@chromium.org <caitkp@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2013-11-13 10:01:01 +0000 |
---|---|---|
committer | caitkp@chromium.org <caitkp@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2013-11-13 10:01:01 +0000 |
commit | 91f0755c0f15ae1f49dc2d38309f9c5882945a18 (patch) | |
tree | 7072b3d791f6f811300eafac5b55b71d87340085 /chrome_elf | |
parent | a644bc199536de369b6a9feb66dba1b4f2b69e0a (diff) | |
download | chromium_src-91f0755c0f15ae1f49dc2d38309f9c5882945a18.zip chromium_src-91f0755c0f15ae1f49dc2d38309f9c5882945a18.tar.gz chromium_src-91f0755c0f15ae1f49dc2d38309f9c5882945a18.tar.bz2 |
Chrome Early Loading Framework
chrome_elf.dll is shipped in Chrome's version directory to
ease updates, and is loaded early in chrome.exe's lifetime
by making it a private assembly in a subfolder of
chrome.exe's folder (see
http://msdn.microsoft.com/library/aa374224.aspx).
BUG= http://crosbug.com/p/23889
Review URL: https://codereview.chromium.org/53793002
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@234795 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome_elf')
-rw-r--r-- | chrome_elf/DEPS | 2 | ||||
-rw-r--r-- | chrome_elf/OWNERS | 3 | ||||
-rw-r--r-- | chrome_elf/README | 15 | ||||
-rw-r--r-- | chrome_elf/chrome_elf.def | 4 | ||||
-rw-r--r-- | chrome_elf/chrome_elf.gyp | 26 | ||||
-rw-r--r-- | chrome_elf/chrome_elf_main.cc | 16 | ||||
-rw-r--r-- | chrome_elf/chrome_elf_main.h | 10 | ||||
-rw-r--r-- | chrome_elf/chrome_exe_manifest.template | 10 | ||||
-rw-r--r-- | chrome_elf/chrome_exe_manifest_action.gypi | 34 | ||||
-rw-r--r-- | chrome_elf/version_assembly_manifest.template | 8 | ||||
-rw-r--r-- | chrome_elf/version_assembly_manifest_action.gypi | 37 |
11 files changed, 165 insertions, 0 deletions
diff --git a/chrome_elf/DEPS b/chrome_elf/DEPS new file mode 100644 index 0000000..48e8875 --- /dev/null +++ b/chrome_elf/DEPS @@ -0,0 +1,2 @@ +include_rules = [ +] diff --git a/chrome_elf/OWNERS b/chrome_elf/OWNERS new file mode 100644 index 0000000..d2e52d6 --- /dev/null +++ b/chrome_elf/OWNERS @@ -0,0 +1,3 @@ + caitkp@chromium.org + gab@chromium.org + robertshield@chromium.org
\ No newline at end of file diff --git a/chrome_elf/README b/chrome_elf/README new file mode 100644 index 0000000..b657437 --- /dev/null +++ b/chrome_elf/README @@ -0,0 +1,15 @@ +Chrome Early Loading Framework (aka ChromeELF) + +chrome_elf.dll is shipped in Chrome's version directory to ease updates, +and is loaded early in chrome.exe's lifetime. This is done by turning the +version directory into a private assembly which refers to chrome_elf.dll +(http://msdn.microsoft.com/library/aa374224.aspx). + +In an ideal world, this would be done by embedding an application config in +chrome.exe that would refer to the proper version directory via a +probing\privatePath attribute (http://msdn.microsoft.com/library/aa374182.aspx). +This would allow us to refer to dlls in the version directory without having to +make the version directory itself into an assembly. It would also avoid naming +conflicts (as the WinSxS dir and GAC both take precedence over private +assemblies when searching for dlls). Unfortunately, the probing\privatePath +attribute is only supported for Windows 7 and later. diff --git a/chrome_elf/chrome_elf.def b/chrome_elf/chrome_elf.def new file mode 100644 index 0000000..1703016 --- /dev/null +++ b/chrome_elf/chrome_elf.def @@ -0,0 +1,4 @@ +LIBRARY "chrome_elf.dll" + +EXPORTS + InitChromeElf diff --git a/chrome_elf/chrome_elf.gyp b/chrome_elf/chrome_elf.gyp new file mode 100644 index 0000000..c32f710 --- /dev/null +++ b/chrome_elf/chrome_elf.gyp @@ -0,0 +1,26 @@ +# Copyright 2013 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. +{ + 'variables': { + 'chromium_code': 1, + }, + 'includes': [ + '../build/win_precompile.gypi', + '../chrome/version.gypi', + ], + 'targets': [ + { + 'target_name': 'chrome_elf', + 'type': 'shared_library', + 'include_dirs': [ + '..', + ], + 'sources': [ + 'chrome_elf.def', + 'chrome_elf_main.cc', + 'chrome_elf_main.h', + ], + }, + ], +}
\ No newline at end of file diff --git a/chrome_elf/chrome_elf_main.cc b/chrome_elf/chrome_elf_main.cc new file mode 100644 index 0000000..c6715ba --- /dev/null +++ b/chrome_elf/chrome_elf_main.cc @@ -0,0 +1,16 @@ +// Copyright 2013 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. + +#include <windows.h> + +#include "chrome_elf/chrome_elf_main.h" + +void InitChromeElf() { + // This method is a no-op which may be called to force a load-time dependency + // on chrome_elf.dll. +} + +BOOL APIENTRY DllMain(HMODULE module, DWORD reason, LPVOID reserved) { + return TRUE; +} diff --git a/chrome_elf/chrome_elf_main.h b/chrome_elf/chrome_elf_main.h new file mode 100644 index 0000000..7d02ddd --- /dev/null +++ b/chrome_elf/chrome_elf_main.h @@ -0,0 +1,10 @@ +// Copyright 2013 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. + +#ifndef CHROME_ELF_CHROME_ELF_MAIN_H_ +#define CHROME_ELF_CHROME_ELF_MAIN_H_ + +extern "C" void InitChromeElf(); + +#endif // CHROME_ELF_CHROME_ELF_MAIN_H_ diff --git a/chrome_elf/chrome_exe_manifest.template b/chrome_elf/chrome_exe_manifest.template new file mode 100644 index 0000000..7c66328 --- /dev/null +++ b/chrome_elf/chrome_exe_manifest.template @@ -0,0 +1,10 @@ +<?xml version="1.0" encoding="UTF-8" standalone="yes"?> +<assembly xmlns="urn:schemas-microsoft-com:asm.v1" manifestVersion="1.0"> + <dependency> + <dependentAssembly> + <assemblyIdentity type='win32' + name='@MAJOR@.@MINOR@.@BUILD@.@PATCH@' + version='@MAJOR@.@MINOR@.@BUILD@.@PATCH@' language='*'/> + </dependentAssembly> + </dependency> +</assembly>
\ No newline at end of file diff --git a/chrome_elf/chrome_exe_manifest_action.gypi b/chrome_elf/chrome_exe_manifest_action.gypi new file mode 100644 index 0000000..89453db --- /dev/null +++ b/chrome_elf/chrome_exe_manifest_action.gypi @@ -0,0 +1,34 @@ +# Copyright 2013 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. + +# This file contains an action which can be used to construct a manifest file +# declaring a dependency on chrome_elf.dll. This manifest can then be merged +# into the manifest of the executable and embedded into it when it is built. + +# To use this the following variables need to be defined: +# version_path: string: path to file containing version data (e.g. +# chrome/VERSION). +# version_py_path: string: path to file containing version script (e.g. +# chrome/tools/build/version.py). + +{ + 'variables': { + 'template_input_path': + '<(DEPTH)/chrome_elf/chrome_exe_manifest.template', + }, + 'inputs': [ + '<(template_input_path)', + '<(version_path)', + ], + 'outputs': [ + '<(SHARED_INTERMEDIATE_DIR)/chrome_elf/version_assembly.manifest', + ], + 'action': [ + 'python', '<(version_py_path)', + '-f', '<(version_path)', + '<(template_input_path)', + '<@(_outputs)', + ], + 'message': 'Generating <@(_outputs)', +}
\ No newline at end of file diff --git a/chrome_elf/version_assembly_manifest.template b/chrome_elf/version_assembly_manifest.template new file mode 100644 index 0000000..153194c --- /dev/null +++ b/chrome_elf/version_assembly_manifest.template @@ -0,0 +1,8 @@ +<assembly + xmlns='urn:schemas-microsoft-com:asm.v1' manifestVersion='1.0'> + <assemblyIdentity + name='@MAJOR@.@MINOR@.@BUILD@.@PATCH@' + version='@MAJOR@.@MINOR@.@BUILD@.@PATCH@' + type='win32'/> + <file name='chrome_elf.dll'/> +</assembly>
\ No newline at end of file diff --git a/chrome_elf/version_assembly_manifest_action.gypi b/chrome_elf/version_assembly_manifest_action.gypi new file mode 100644 index 0000000..9c44315 --- /dev/null +++ b/chrome_elf/version_assembly_manifest_action.gypi @@ -0,0 +1,37 @@ +# Copyright 2013 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. + +# This file contains an action which can be used to construct a manifest file +# with the same name as the version directory so that chrome.exe identifies the +# version directory as an assembly. This will be copied over to the version +# directory by the installer script. + +# To use this the following variables need to be defined: +# version_path: string: path to file containing version data (e.g. +# chrome/VERSION). +# version_py_path: string: path to file containing version script (e.g. +# chrome/tools/build/version.py). +# version_full: string: version string in W.X.Y.Z form. + + +{ + 'variables': { + 'template_input_path': + '<(DEPTH)/chrome_elf/version_assembly_manifest.template', + }, + 'inputs': [ + '<(template_input_path)', + '<(version_path)', + ], + 'outputs': [ + '<(PRODUCT_DIR)/<(version_full).manifest', + ], + 'action': [ + 'python', '<(version_py_path)', + '-f', '<(version_path)', + '<(template_input_path)', + '<@(_outputs)', + ], + 'message': 'Generating <@(_outputs)', +}
\ No newline at end of file |