Skip to content
This repository was archived by the owner on Feb 25, 2025. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 1 addition & 9 deletions sky/shell/linux/main.cc
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand Down Expand Up @@ -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;
}

Expand Down
10 changes: 1 addition & 9 deletions sky/shell/mac/main_mac.mm
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand Down Expand Up @@ -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 {
Expand Down
12 changes: 12 additions & 0 deletions sky/shell/switches.cc
Original file line number Diff line number Diff line change
Expand Up @@ -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 changes: 5 additions & 0 deletions sky/shell/switches.h
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@
#ifndef SKY_SHELL_SWITCHES_H_
#define SKY_SHELL_SWITCHES_H_

#include <string>

namespace sky {
namespace shell {
namespace switches {
Expand All @@ -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
Expand Down
7 changes: 7 additions & 0 deletions sky/shell/ui/engine.cc
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand All @@ -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"
Expand Down Expand Up @@ -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) {
Expand Down