提交 2612c841 编写于 作者: A Adam Barth

Add --enable-checked-mode to sky_shell

We need a way for developers to use release builds in checked mode.

Progress on #400
上级 fb1720c0
......@@ -23,14 +23,6 @@ namespace sky {
namespace shell {
namespace {
void Usage() {
std::cerr << "Usage: sky_shell"
<< " --" << switches::kNonInteractive
<< " --" << switches::kPackageRoot << "=PACKAGE_ROOT"
<< " --" << switches::kSnapshot << "=SNAPSHOT"
<< " [ MAIN_DART ]" << std::endl;
}
void Init() {
base::CommandLine& command_line = *base::CommandLine::ForCurrentProcess();
blink::WebRuntimeFeatures::enableObservatory(
......@@ -72,7 +64,7 @@ int main(int argc, const char* argv[]) {
if (command_line.HasSwitch(sky::shell::switches::kHelp) ||
(!command_line.HasSwitch(sky::shell::switches::kPackageRoot) &&
!command_line.HasSwitch(sky::shell::switches::kSnapshot))) {
sky::shell::Usage();
sky::shell::switches::PrintUsage("sky_shell");
return 0;
}
......
......@@ -29,14 +29,6 @@ bool FlagsValid() {
return true;
}
void Usage() {
std::cerr << "(For Test Shell) Usage: sky_shell"
<< " --" << switches::kNonInteractive << " --"
<< switches::kPackageRoot << "=PACKAGE_ROOT"
<< " --" << switches::kSnapshot << "=SNAPSHOT"
<< " [ MAIN_DART ]" << std::endl;
}
void Init() {
base::CommandLine& command_line = *base::CommandLine::ForCurrentProcess();
blink::WebRuntimeFeatures::enableObservatory(
......@@ -83,7 +75,7 @@ int main(int argc, const char* argv[]) {
return PlatformMacMain(argc, argv, ^() {
if (!sky::shell::FlagsValid()) {
sky::shell::Usage();
sky::shell::switches::PrintUsage("SkyShell");
sky::shell::AttachMessageLoopToMainRunLoop();
return NSApplicationMain(argc, argv);
} else {
......
......@@ -4,15 +4,27 @@
#include "sky/shell/switches.h"
#include <iostream>
namespace sky {
namespace shell {
namespace switches {
const char kEnableCheckedMode[] = "enable-checked-mode";
const char kHelp[] = "help";
const char kNonInteractive[] = "non-interactive";
const char kPackageRoot[] = "package-root";
const char kSnapshot[] = "snapshot";
void PrintUsage(const std::string& executable_name) {
std::cerr << "Usage: " << executable_name
<< " --" << kEnableCheckedMode
<< " --" << kNonInteractive
<< " --" << kPackageRoot << "=PACKAGE_ROOT"
<< " --" << kSnapshot << "=SNAPSHOT"
<< " [ MAIN_DART ]" << std::endl;
}
} // namespace switches
} // namespace shell
} // namespace sky
......@@ -5,6 +5,8 @@
#ifndef SKY_SHELL_SWITCHES_H_
#define SKY_SHELL_SWITCHES_H_
#include <string>
namespace sky {
namespace shell {
namespace switches {
......@@ -13,6 +15,9 @@ extern const char kHelp[];
extern const char kPackageRoot[];
extern const char kNonInteractive[];
extern const char kSnapshot[];
extern const char kEnableCheckedMode[];
void PrintUsage(const std::string& executable_name);
} // namespace switches
} // namespace shell
......
......@@ -5,6 +5,7 @@
#include "sky/shell/ui/engine.h"
#include "base/bind.h"
#include "base/command_line.h"
#include "base/files/file_path.h"
#include "base/threading/worker_pool.h"
#include "base/trace_event/trace_event.h"
......@@ -15,9 +16,11 @@
#include "sky/engine/public/platform/sky_display_metrics.h"
#include "sky/engine/public/platform/sky_display_metrics.h"
#include "sky/engine/public/web/Sky.h"
#include "sky/engine/public/web/WebRuntimeFeatures.h"
#include "sky/shell/dart/dart_library_provider_files.h"
#include "sky/shell/dart/dart_library_provider_network.h"
#include "sky/shell/service_provider.h"
#include "sky/shell/switches.h"
#include "sky/shell/ui/animator.h"
#include "sky/shell/ui/input_event_converter.h"
#include "sky/shell/ui/internals.h"
......@@ -87,6 +90,10 @@ void Engine::Init() {
DCHECK(!g_platform_impl);
g_platform_impl = new PlatformImpl();
blink::initialize(g_platform_impl);
base::CommandLine& command_line = *base::CommandLine::ForCurrentProcess();
blink::WebRuntimeFeatures::enableDartCheckedMode(
command_line.HasSwitch(switches::kEnableCheckedMode));
}
void Engine::BeginFrame(base::TimeTicks frame_time) {
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册