Skip to content

Commit

Permalink
Switched Kasko to use the new buildflag system.
Browse files Browse the repository at this point in the history
Moved gyp build to third_party/kasko

Also fixed some build issues that came with rebasing to tip of tree.

Review URL: https://codereview.chromium.org/1526213002

Cr-Commit-Position: refs/heads/master@{#368212}
  • Loading branch information
plmonette-zz authored and Commit bot committed Jan 8, 2016
1 parent ab0c130 commit 502a83e
Show file tree
Hide file tree
Showing 36 changed files with 178 additions and 117 deletions.
1 change: 1 addition & 0 deletions .gn
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,7 @@ check_targets = [
"//testing/*",

#"//third_party/*", # May not ever want this.
"//third_party/kasko/*",
"//third_party/WebKit/Source/*",
"//tools/*",

Expand Down
12 changes: 4 additions & 8 deletions build/common.gypi
Original file line number Diff line number Diff line change
Expand Up @@ -482,6 +482,9 @@
# Enable crash reporting via Kasko.
'kasko%': 0,

# Enable hang reports in Kasko.
'kasko_hang_reports%': 0,

# Enable building with LSan (Clang's -fsanitize=leak option).
# -fsanitize=leak only works with clang, but lsan=1 implies clang=1
# See https://sites.google.com/a/chromium.org/dev/developers/testing/leaksanitizer
Expand Down Expand Up @@ -1192,6 +1195,7 @@
'use_sanitizer_options%': '<(use_sanitizer_options)',
'syzyasan%': '<(syzyasan)',
'kasko%': '<(kasko)',
'kasko_hang_reports%': '<(kasko_hang_reports)',
'syzygy_optimize%': '<(syzygy_optimize)',
'lsan%': '<(lsan)',
'msan%': '<(msan)',
Expand Down Expand Up @@ -2891,14 +2895,6 @@
'MEMORY_SANITIZER_INITIAL_SIZE',
],
}],
['kasko==1', {
'defines': [
'KASKO',
],
'include_dirs': [
'<(DEPTH)/third_party/kasko/include',
],
}],
['OS=="win"', {
'defines': [
'__STD_C',
Expand Down
1 change: 1 addition & 0 deletions chrome/BUILD.gn
Original file line number Diff line number Diff line change
Expand Up @@ -316,6 +316,7 @@ if (is_mac || is_win) {
"//base/trace_event/etw_manifest:chrome_events_win",
"//chrome/app/theme:chrome_unscaled_resources",
"//chrome_elf",
"//components/crash/content/app",
"//content/app/resources",
"//crypto",
"//net:net_resources",
Expand Down
1 change: 1 addition & 0 deletions chrome/app/DEPS
Original file line number Diff line number Diff line change
Expand Up @@ -32,4 +32,5 @@ include_rules = [
"+sandbox",
"+syzygy/kasko/api",
"+third_party/crashpad/crashpad",
"+third_party/kasko",
]
5 changes: 3 additions & 2 deletions chrome/app/kasko_client.cc
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,11 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

#if defined(KASKO)

#include "chrome/app/kasko_client.h"

#if BUILDFLAG(ENABLE_KASKO)

#include <windows.h>
#include <stddef.h>

Expand Down Expand Up @@ -115,4 +116,4 @@ extern "C" void __declspec(dllexport) ReportCrashWithProtobuf(
nullptr, nullptr);
}

#endif // defined(KASKO)
#endif // BUILDFLAG(ENABLE_KASKO)
6 changes: 4 additions & 2 deletions chrome/app/kasko_client.h
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,9 @@
#ifndef CHROME_APP_KASKO_CLIENT_H_
#define CHROME_APP_KASKO_CLIENT_H_

#if defined(KASKO)
#include "third_party/kasko/kasko_features.h"

#if BUILDFLAG(ENABLE_KASKO)

#include "base/macros.h"
#include "syzygy/kasko/api/minidump_type.h"
Expand All @@ -28,6 +30,6 @@ class KaskoClient {
DISALLOW_COPY_AND_ASSIGN(KaskoClient);
};

#endif // KASKO
#endif // BUILDFLAG(ENABLE_KASKO)

#endif // CHROME_APP_KASKO_CLIENT_H_
19 changes: 11 additions & 8 deletions chrome/app/main_dll_loader_win.cc
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,10 @@ void ClearDidRun(const base::FilePath& dll_path) {

typedef int (*InitMetro)();

#if defined(KASKO)
#if BUILDFLAG(ENABLE_KASKO)

// For ::GetProfileType().
#pragma comment(lib, "userenv.lib")

// For ::GetProfileType().
#pragma comment(lib, "userenv.lib")
Expand Down Expand Up @@ -156,7 +159,7 @@ std::wstring GetProfileType() {
return profile_type;
}

#endif // KASKO
#endif // BUILDFLAG(ENABLE_KASKO)

} // namespace

Expand Down Expand Up @@ -317,9 +320,9 @@ class ChromeDllLoader : public MainDllLoader {

private:
scoped_ptr<ChromeWatcherClient> chrome_watcher_client_;
#if defined(KASKO)
#if BUILDFLAG(ENABLE_KASKO)
scoped_ptr<KaskoClient> kasko_client_;
#endif // KASKO
#endif
};

void ChromeDllLoader::OnBeforeLaunch(const std::string& process_type,
Expand All @@ -340,7 +343,7 @@ void ChromeDllLoader::OnBeforeLaunch(const std::string& process_type,
chrome_watcher_client_.reset(new ChromeWatcherClient(
base::Bind(&GenerateChromeWatcherCommandLine, exe_path)));
if (chrome_watcher_client_->LaunchWatcher()) {
#if defined(KASKO)
#if BUILDFLAG(ENABLE_KASKO)
kasko::api::MinidumpType minidump_type = kasko::api::SMALL_DUMP_TYPE;
if (base::CommandLine::ForCurrentProcess()->HasSwitch(
switches::kFullMemoryCrashReport)) {
Expand All @@ -359,7 +362,7 @@ void ChromeDllLoader::OnBeforeLaunch(const std::string& process_type,

kasko_client_.reset(
new KaskoClient(chrome_watcher_client_.get(), minidump_type));
#endif // KASKO
#endif // BUILDFLAG(ENABLE_KASKO)
}
}
}
Expand All @@ -382,9 +385,9 @@ int ChromeDllLoader::OnBeforeExit(int return_code,
ClearDidRun(dll_path);
}

#if defined(KASKO)
#if BUILDFLAG(ENABLE_KASKO)
kasko_client_.reset();
#endif // KASKO
#endif
chrome_watcher_client_.reset();

return return_code;
Expand Down
2 changes: 2 additions & 0 deletions chrome/browser/BUILD.gn
Original file line number Diff line number Diff line change
Expand Up @@ -369,6 +369,7 @@ source_set("browser") {
"//storage/common",
"//third_party/WebKit/public:image_resources",
"//third_party/WebKit/public:resources",
"//third_party/kasko",
"//third_party/leveldatabase",
"//third_party/libaddressinput",
"//third_party/libyuv",
Expand Down Expand Up @@ -843,6 +844,7 @@ source_set("browser") {
]
deps += [
":chrome_process_finder",
"//chrome/chrome_watcher:client",
"//chrome/common:version_header",
"//chrome/installer/util:strings",
"//chrome_elf",
Expand Down
1 change: 1 addition & 0 deletions chrome/browser/DEPS
Original file line number Diff line number Diff line change
Expand Up @@ -171,6 +171,7 @@ include_rules = [
"+sync/util", # Sync utilities like GetSessionName.
"+syzygy/kasko",
"+third_party/cros_system_api",
"+third_party/kasko",
"+win8/util",

# chrome only needs switches from cc. All usage of the compositor is from
Expand Down
10 changes: 5 additions & 5 deletions chrome/browser/chrome_browser_main_win.cc
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@
#include "chrome/browser/google/did_run_updater_win.h"
#endif

#if defined(KASKO)
#if BUILDFLAG(ENABLE_KASKO)
#include "syzygy/kasko/api/reporter.h"
#endif

Expand Down Expand Up @@ -122,7 +122,7 @@ void ExecuteFontCacheBuildTask(const base::FilePath& path) {
new ChromeUtilityHostMsg_BuildDirectWriteFontCache(path));
}

#if defined(KASKO)
#if BUILDFLAG(ENABLE_KASKO)
void ObserveFailedCrashReportDirectory(const base::FilePath& path, bool error) {
DCHECK(!error);
if (error)
Expand Down Expand Up @@ -155,7 +155,7 @@ void StartFailedKaskoCrashReportWatcher(base::FilePathWatcher* watcher) {
ObserveFailedCrashReportDirectory(permanent_failure_directory, false);
}
}
#endif
#endif // BUILDFLAG(ENABLE_KASKO)

void DetectFaultTolerantHeap() {
enum FTHFlags {
Expand Down Expand Up @@ -385,13 +385,13 @@ void ChromeBrowserMainPartsWin::PostBrowserStart() {

InitializeChromeElf();

#if defined(KASKO)
#if BUILDFLAG(ENABLE_KASKO)
content::BrowserThread::PostDelayedTask(
content::BrowserThread::FILE, FROM_HERE,
base::Bind(&StartFailedKaskoCrashReportWatcher,
base::Unretained(&failed_kasko_crash_report_watcher_)),
base::TimeDelta::FromMinutes(5));
#endif
#endif // BUILDFLAG(ENABLE_KASKO)

#if defined(GOOGLE_CHROME_BUILD)
did_run_updater_.reset(new DidRunUpdater);
Expand Down
3 changes: 2 additions & 1 deletion chrome/browser/chrome_browser_main_win.h
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
#include "base/files/file_path_watcher.h"
#include "base/macros.h"
#include "chrome/browser/chrome_browser_main.h"
#include "third_party/kasko/kasko_features.h"

class DidRunUpdater;

Expand Down Expand Up @@ -72,7 +73,7 @@ class ChromeBrowserMainPartsWin : public ChromeBrowserMainParts {
#if defined(GOOGLE_CHROME_BUILD)
scoped_ptr<DidRunUpdater> did_run_updater_;
#endif
#if defined(KASKO)
#if BUILDFLAG(ENABLE_KASKO)
// Cleans up Kasko crash reports that exceeded the maximum upload attempts.
base::FilePathWatcher failed_kasko_crash_report_watcher_;
#endif
Expand Down
36 changes: 0 additions & 36 deletions chrome/chrome.gyp
Original file line number Diff line number Diff line change
Expand Up @@ -773,41 +773,5 @@
},
],
}],
['kasko==1', {
'variables': {
'kasko_exe_dir': '<(DEPTH)/third_party/kasko/binaries',
},
'targets': [
{
'target_name': 'kasko_dll',
'type': 'none',
'outputs': [
'<(PRODUCT_DIR)/kasko.dll',
'<(PRODUCT_DIR)/kasko.dll.pdb',
],
'copies': [
{
'destination': '<(PRODUCT_DIR)',
'files': [
'<(kasko_exe_dir)/kasko.dll',
'<(kasko_exe_dir)/kasko.dll.pdb',
],
},
],
'direct_dependent_settings': {
'msvs_settings': {
'VCLinkerTool': {
'AdditionalDependencies': [
'kasko.dll.lib',
],
'AdditionalLibraryDirectories': [
'<(DEPTH)/third_party/kasko/binaries'
],
},
},
},
},
],
}],
], # 'conditions'
}
10 changes: 2 additions & 8 deletions chrome/chrome_browser.gypi
Original file line number Diff line number Diff line change
Expand Up @@ -3816,24 +3816,18 @@
'../google_update/google_update.gyp:google_update',
'../third_party/iaccessible2/iaccessible2.gyp:iaccessible2',
'../third_party/isimpledom/isimpledom.gyp:isimpledom',
'../third_party/kasko/kasko.gyp:kasko',
'../ui/metro_viewer/metro_viewer.gyp:metro_viewer_messages',
'../ui/views/controls/webview/webview.gyp:webview',
'../ui/views/views.gyp:views',
'../win8/win8.gyp:metro_viewer',
],
'export_dependent_settings': [
'../third_party/kasko/kasko.gyp:kasko',
'../ui/views/controls/webview/webview.gyp:webview',
'../ui/views/views.gyp:views',
],
'conditions': [
['kasko==1', {
'dependencies': [
'kasko_dll',
],
'export_dependent_settings': [
'kasko_dll',
],
}],
['branding!="Chrome"', {
'dependencies!': [
'../google_update/google_update.gyp:google_update',
Expand Down
1 change: 1 addition & 0 deletions chrome/chrome_common.gypi
Original file line number Diff line number Diff line change
Expand Up @@ -352,6 +352,7 @@
'<(DEPTH)/skia/skia.gyp:skia_library',
'<(DEPTH)/third_party/icu/icu.gyp:icui18n',
'<(DEPTH)/third_party/icu/icu.gyp:icuuc',
'<(DEPTH)/third_party/kasko/kasko.gyp:kasko_features',
'<(DEPTH)/third_party/zlib/google/zip.gyp:zip',
'<(DEPTH)/ui/gfx/ipc/gfx_ipc.gyp:gfx_ipc',
'<(DEPTH)/ui/resources/ui_resources.gyp:ui_resources',
Expand Down
1 change: 1 addition & 0 deletions chrome/chrome_dll.gypi
Original file line number Diff line number Diff line change
Expand Up @@ -351,6 +351,7 @@
'<@(chromium_child_dependencies)',
'../components/components.gyp:browser_watcher_client',
'../content/content.gyp:content_app_child',
'../third_party/kasko/kasko.gyp:kasko',
'chrome_version_resources',
'policy_path_parser',
],
Expand Down
10 changes: 2 additions & 8 deletions chrome/chrome_exe.gypi
Original file line number Diff line number Diff line change
Expand Up @@ -105,20 +105,13 @@
'../components/components.gyp:browser_watcher_client',
'../components/components.gyp:crash_component',
'../third_party/crashpad/crashpad/handler/handler.gyp:crashpad_handler_lib',
'../third_party/kasko/kasko.gyp:kasko',
],
'sources': [
'app/chrome_crash_reporter_client.cc',
'app/chrome_crash_reporter_client.h',
],
'conditions': [
['kasko==1', {
'dependencies': [
'kasko_dll',
],
'sources': [
'app/chrome_crash_reporter_client.cc',
],
}],
['win_console_app==1', {
'defines': ['WIN_CONSOLE_APP'],
}],
Expand Down Expand Up @@ -433,6 +426,7 @@
'../components/components.gyp:crash_core_common',
'../components/components.gyp:flags_ui_switches',
'../sandbox/sandbox.gyp:sandbox',
'../third_party/kasko/kasko.gyp:kasko_features',
'../ui/gfx/gfx.gyp:gfx',
'../win8/metro_driver/metro_driver.gyp:metro_driver',
'../win8/delegate_execute/delegate_execute.gyp:*',
Expand Down
1 change: 1 addition & 0 deletions chrome/chrome_tests_unit.gypi
Original file line number Diff line number Diff line change
Expand Up @@ -2889,6 +2889,7 @@
'../components/components.gyp:crash_core_common',
'../components/components.gyp:flags_ui_switches',
'../content/content.gyp:content_app_both',
'../third_party/kasko/kasko.gyp:kasko_features',
# 2) test-specific support libraries:
'../base/base.gyp:run_all_unittests',
'../testing/gmock.gyp:gmock',
Expand Down
1 change: 1 addition & 0 deletions chrome/chrome_watcher/DEPS
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,5 @@ include_rules = [
"+chrome/installer/util",
"+components/browser_watcher",
"+syzygy/kasko/api",
"+third_party/kasko",
]
8 changes: 1 addition & 7 deletions chrome/chrome_watcher/chrome_watcher.gypi
Original file line number Diff line number Diff line change
Expand Up @@ -64,13 +64,7 @@
'installer_util',
'../base/base.gyp:base',
'../components/components.gyp:browser_watcher',
],
'conditions': [
['kasko==1', {
'dependencies': [
'kasko_dll',
],
}],
'../third_party/kasko/kasko.gyp:kasko',
],
'msvs_settings': {
'VCLinkerTool': {
Expand Down
Loading

0 comments on commit 502a83e

Please sign in to comment.