diff options
author | caryclark <caryclark@google.com> | 2014-07-22 10:15:34 -0700 |
---|---|---|
committer | Commit bot <commit-bot@chromium.org> | 2014-07-22 10:15:35 -0700 |
commit | 17f0b6df7248b9bbdaddacc3a6c9c6efe4ae278e (patch) | |
tree | 4e8140b396a43b1aee58cc0ab5fe84c63fbe2f3e /experimental | |
parent | ac9779234ef7a8cf3d791ab7690ef8c388662836 (diff) |
share dm and command flags
Share command flags between dm and unit tests.
Also, allow dm's core to be included by itself and iOSShell.
Command line flags that are the same (or nearly the same) in DM
and in skia_tests have been moved to common_flags. Authors,
please check to see that the shared common flag is correct for
the tool.
For iOS, the 'tool_main' entry point has a wrapper to allow multiple
tools to be statically linked in the iOSShell.
Since SkCommandLineFlags::Parse can only be called once, these calls
are disabled in the IOS build.
Since the iOS app directory is dynamically assigned a name, use '@' to
select it. (This is the same convention chosen by the Mobile Harness
iOS file system utilities.)
Move the heart of dm.gyp into dm.gypi so that it can be included by
itself and iOSShell.gyp.
Add tools/flags/SkCommonFlags.* to define and declare common
command line flags.
Add support for dm to iOSShell.
BUG=skia:
R=scroggo@google.com, mtklein@google.com, jvanverth@google.com, bsalomon@google.com
Author: caryclark@google.com
Review URL: https://codereview.chromium.org/389653004
Diffstat (limited to 'experimental')
-rw-r--r-- | experimental/SimpleiOSApp/SimpleApp.mm | 11 | ||||
-rw-r--r-- | experimental/iOSSampleApp/Shared/skia_ios.mm | 8 |
2 files changed, 9 insertions, 10 deletions
diff --git a/experimental/SimpleiOSApp/SimpleApp.mm b/experimental/SimpleiOSApp/SimpleApp.mm index 44b646f54f..040472cfe3 100644 --- a/experimental/SimpleiOSApp/SimpleApp.mm +++ b/experimental/SimpleiOSApp/SimpleApp.mm @@ -1,11 +1,12 @@ +#include "SkApplication.h" #import "SkCanvas.h" #import "SkPaint.h" #import "SkWindow.h" #include "SkGraphics.h" #include "SkCGUtils.h" -extern void tool_main(int argc, char *argv[]); -extern bool set_cmd_line_args(int argc, char *argv[], const char* dir); +void dummy_main(int , char *[]) { +} class SkSampleView : public SkView { public: @@ -41,10 +42,10 @@ void application_term() { int saved_argc; char** saved_argv; -bool set_cmd_line_args(int argc, char *argv[], const char* ) { +IOS_launch_type set_cmd_line_args(int argc, char *argv[], const char* ) { saved_argc = argc; saved_argv = argv; - return true; + return kTool_iOSLaunchType; } class FillLayout : public SkView::Layout { @@ -59,7 +60,7 @@ protected: @implementation SimpleApp - (id)initWithDefaults { - (void) tool_main(saved_argc, saved_argv); + dummy_main(saved_argc, saved_argv); if (self = [super initWithDefaults]) { fWind = new SkOSWindow(self); fWind->setLayout(new FillLayout, false); diff --git a/experimental/iOSSampleApp/Shared/skia_ios.mm b/experimental/iOSSampleApp/Shared/skia_ios.mm index 4fce1392d8..45675fa61a 100644 --- a/experimental/iOSSampleApp/Shared/skia_ios.mm +++ b/experimental/iOSSampleApp/Shared/skia_ios.mm @@ -1,8 +1,6 @@ #import <UIKit/UIKit.h> #include "SkApplication.h" -extern bool set_cmd_line_args(int argc, char *argv[], const char* dir); - int main(int argc, char *argv[]) { signal(SIGPIPE, SIG_IGN); NSAutoreleasePool * pool = [[NSAutoreleasePool alloc] init]; @@ -11,9 +9,9 @@ int main(int argc, char *argv[]) { NSArray *dirPaths = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES); NSString *docsDir = [dirPaths objectAtIndex:0]; const char *d = [docsDir UTF8String]; - - bool ranCommand = set_cmd_line_args(argc, argv, d); - int retVal = ranCommand ? 0 : UIApplicationMain(argc, argv, nil, nil); + IOS_launch_type launchType = set_cmd_line_args(argc, argv, d); + int retVal = launchType == kApplication__iOSLaunchType + ? UIApplicationMain(argc, argv, nil, nil) : (int) launchType; application_term(); [pool release]; return retVal; |