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

Side by Side Diff: gin/shell/gin_main.cc

Issue 179803007: Refactors parts of gin: (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: fix gin_shell Created 6 years, 9 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « gin/runner_unittest.cc ('k') | gin/shell_runner.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "base/at_exit.h" 5 #include "base/at_exit.h"
6 #include "base/bind.h" 6 #include "base/bind.h"
7 #include "base/command_line.h" 7 #include "base/command_line.h"
8 #include "base/file_util.h" 8 #include "base/file_util.h"
9 #include "base/i18n/icu_util.h" 9 #include "base/i18n/icu_util.h"
10 #include "base/message_loop/message_loop.h" 10 #include "base/message_loop/message_loop.h"
(...skipping 25 matching lines...) Expand all
36 CHECK(file_util::GetCurrentDirectory(&module_base[0])); 36 CHECK(file_util::GetCurrentDirectory(&module_base[0]));
37 return module_base; 37 return module_base;
38 } 38 }
39 39
40 class ShellRunnerDelegate : public ModuleRunnerDelegate { 40 class ShellRunnerDelegate : public ModuleRunnerDelegate {
41 public: 41 public:
42 ShellRunnerDelegate() : ModuleRunnerDelegate(GetModuleSearchPaths()) { 42 ShellRunnerDelegate() : ModuleRunnerDelegate(GetModuleSearchPaths()) {
43 AddBuiltinModule(Console::kModuleName, Console::GetModule); 43 AddBuiltinModule(Console::kModuleName, Console::GetModule);
44 } 44 }
45 45
46 virtual void UnhandledException(Runner* runner, 46 virtual void UnhandledException(ShellRunner* runner,
47 TryCatch& try_catch) OVERRIDE { 47 TryCatch& try_catch) OVERRIDE {
48 ModuleRunnerDelegate::UnhandledException(runner, try_catch); 48 ModuleRunnerDelegate::UnhandledException(runner, try_catch);
49 LOG(ERROR) << try_catch.GetStackTrace(); 49 LOG(ERROR) << try_catch.GetStackTrace();
50 } 50 }
51 51
52 private: 52 private:
53 DISALLOW_COPY_AND_ASSIGN(ShellRunnerDelegate); 53 DISALLOW_COPY_AND_ASSIGN(ShellRunnerDelegate);
54 }; 54 };
55 55
56 } // namespace 56 } // namespace
57 } // namespace gin 57 } // namespace gin
58 58
59 int main(int argc, char** argv) { 59 int main(int argc, char** argv) {
60 base::AtExitManager at_exit; 60 base::AtExitManager at_exit;
61 CommandLine::Init(argc, argv); 61 CommandLine::Init(argc, argv);
62 base::i18n::InitializeICU(); 62 base::i18n::InitializeICU();
63 63
64 gin::IsolateHolder instance; 64 gin::IsolateHolder instance;
65 65
66 base::MessageLoop message_loop; 66 base::MessageLoop message_loop;
67 67
68 gin::ShellRunnerDelegate delegate; 68 gin::ShellRunnerDelegate delegate;
69 gin::Runner runner(&delegate, instance.isolate()); 69 gin::ShellRunner runner(&delegate, instance.isolate());
70 70
71 { 71 {
72 gin::Runner::Scope scope(&runner); 72 gin::Runner::Scope scope(&runner);
73 v8::V8::SetCaptureStackTraceForUncaughtExceptions(true); 73 v8::V8::SetCaptureStackTraceForUncaughtExceptions(true);
74 } 74 }
75 75
76 CommandLine::StringVector args = CommandLine::ForCurrentProcess()->GetArgs(); 76 CommandLine::StringVector args = CommandLine::ForCurrentProcess()->GetArgs();
77 for (CommandLine::StringVector::const_iterator it = args.begin(); 77 for (CommandLine::StringVector::const_iterator it = args.begin();
78 it != args.end(); ++it) { 78 it != args.end(); ++it) {
79 base::MessageLoop::current()->PostTask(FROM_HERE, base::Bind( 79 base::MessageLoop::current()->PostTask(FROM_HERE, base::Bind(
80 gin::Run, runner.GetWeakPtr(), base::FilePath(*it))); 80 gin::Run, runner.GetWeakPtr(), base::FilePath(*it)));
81 } 81 }
82 82
83 message_loop.RunUntilIdle(); 83 message_loop.RunUntilIdle();
84 return 0; 84 return 0;
85 } 85 }
OLDNEW
« no previous file with comments | « gin/runner_unittest.cc ('k') | gin/shell_runner.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698