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

Side by Side Diff: tools/iOSShell.cpp

Issue 389653004: share dm and command flags (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: sync up with latest dm Created 6 years, 5 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
« no previous file with comments | « tools/flags/SkCommonFlags.cpp ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright 2014 Google Inc. 2 * Copyright 2014 Google Inc.
3 * 3 *
4 * Use of this source code is governed by a BSD-style license that can be 4 * Use of this source code is governed by a BSD-style license that can be
5 * found in the LICENSE file. 5 * found in the LICENSE file.
6 */ 6 */
7 7
8 #include "iOSShell.h" 8 #include "iOSShell.h"
9 9
10 #include "Resources.h" 10 #include "Resources.h"
11 #include "SkApplication.h"
11 #include "SkCanvas.h" 12 #include "SkCanvas.h"
12 #include "SkCommandLineFlags.h" 13 #include "SkCommonFlags.h"
13 #include "SkGraphics.h" 14 #include "SkGraphics.h"
15 #include "SkThreadPool.h"
14 #include "SkWindow.h" 16 #include "SkWindow.h"
15 #include "sk_tool_utils.h" 17 #include "sk_tool_utils.h"
16 18
17 ////////////////////////////////////////////////////////////////////////////// 19 //////////////////////////////////////////////////////////////////////////////
18 20
19 static SkView* curr_view(SkWindow* wind) { 21 static SkView* curr_view(SkWindow* wind) {
20 SkView::F2BIter iter(wind); 22 SkView::F2BIter iter(wind);
21 return iter.next(); 23 return iter.next();
22 } 24 }
23 25
(...skipping 21 matching lines...) Expand all
45 } 47 }
46 48
47 void ShellWindow::onSizeChange() { 49 void ShellWindow::onSizeChange() {
48 this->INHERITED::onSizeChange(); 50 this->INHERITED::onSizeChange();
49 51
50 SkView::F2BIter iter(this); 52 SkView::F2BIter iter(this);
51 SkView* view = iter.next(); 53 SkView* view = iter.next();
52 view->setSize(this->width(), this->height()); 54 view->setSize(this->width(), this->height());
53 } 55 }
54 56
55 void tool_main(int argc, char *argv[]); 57 DEFINE_bool(dm, false, "run dm");
58 DEFINE_bool(nanobench, false, "run nanobench");
56 59
57 bool set_cmd_line_args(int argc, char *argv[], const char* resourceDir) { 60 int nanobench_main();
58 for (int index = 0; index < argc; ++index) { 61 int dm_main();
59 if (!strcmp("--test", argv[index])) { 62
60 SetResourcePath(resourceDir); 63 IOS_launch_type set_cmd_line_args(int argc, char *argv[], const char* resourceDi r) {
61 tool_main(argc - 1, argv); 64 SkCommandLineFlags::Parse(argc, argv);
62 return true; 65 SetResourcePath(resourceDir);
63 } 66 if (FLAGS_nanobench) {
67 return nanobench_main() ? kError_iOSLaunchType : kTool_iOSLaunchType;
64 } 68 }
65 return false; 69 if (FLAGS_dm) {
70 return dm_main() ? kError_iOSLaunchType : kTool_iOSLaunchType;
71 }
72 return kError_iOSLaunchType;
66 } 73 }
67 74
68 // FIXME: this should be in a header 75 // FIXME: this should be in a header
69 SkOSWindow* create_sk_window(void* hwnd, int argc, char** argv); 76 SkOSWindow* create_sk_window(void* hwnd, int argc, char** argv);
70 SkOSWindow* create_sk_window(void* hwnd, int argc, char** argv) { 77 SkOSWindow* create_sk_window(void* hwnd, int argc, char** argv) {
71 return new ShellWindow(hwnd, argc, argv); 78 return new ShellWindow(hwnd, argc, argv);
72 } 79 }
73 80
74 // FIXME: this should be in a header 81 // FIXME: this should be in a header
75 void get_preferred_size(int* x, int* y, int* width, int* height); 82 void get_preferred_size(int* x, int* y, int* width, int* height);
(...skipping 10 matching lines...) Expand all
86 SkGraphics::Init(); 93 SkGraphics::Init();
87 SkEvent::Init(); 94 SkEvent::Init();
88 } 95 }
89 96
90 // FIXME: this should be in a header 97 // FIXME: this should be in a header
91 void application_term(); 98 void application_term();
92 void application_term() { 99 void application_term() {
93 SkEvent::Term(); 100 SkEvent::Term();
94 SkGraphics::Term(); 101 SkGraphics::Term();
95 } 102 }
OLDNEW
« no previous file with comments | « tools/flags/SkCommonFlags.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698