From fbcfd6d060f4d42e6b9de70f676564fcf1d97eb5 Mon Sep 17 00:00:00 2001 From: mtklein Date: Thu, 14 Apr 2016 09:42:34 -0700 Subject: [PATCH] mojo -> nojo BUG=skia:4891 GOLD_TRYBOT_URL= https://gold.skia.org/search2?unt=true&query=source_type%3Dgm&master=false&issue=1889543003 Review URL: https://codereview.chromium.org/1889543003 --- DEPS | 3 -- dm/DM.cpp | 1 - dm/DMSrcSink.cpp | 53 ------------------------- experimental/mojo/.gitignore | 6 --- experimental/mojo/SkMojo.mojom | 10 ----- experimental/mojo/generate.py | 74 ----------------------------------- gyp/common_variables.gypi | 2 - gyp/dm.gypi | 1 - gyp/skmojo.gyp | 89 ------------------------------------------ 9 files changed, 239 deletions(-) delete mode 100644 experimental/mojo/.gitignore delete mode 100644 experimental/mojo/SkMojo.mojom delete mode 100755 experimental/mojo/generate.py delete mode 100644 gyp/skmojo.gyp diff --git a/DEPS b/DEPS index 6c7ed58..50cdd46 100644 --- a/DEPS +++ b/DEPS @@ -48,9 +48,6 @@ deps = { # microhttpd for skiaserve "third_party/externals/microhttpd" : "https://android.googlesource.com/platform/external/libmicrohttpd@748945ec6f1c67b7efc934ab0808e1d32f2fb98d", - # Mojo SDK for Mojo RPC experiments. - "third_party/externals/mojo/public" : "https://chromium.googlesource.com/external/github.com/domokit/mojo_sdk@172be18ea745ab29aea132e6cb952e726dc32543", - # shaderc for the vulkan backend "third_party/externals/shaderc2" : "https://github.com/google/shaderc.git@d63c5e070fa966a33e1d352b2272bd57e1e9da00", "third_party/externals/shaderc2/third_party/googletest" : "https://github.com/google/googletest.git@d225acc90bc3a8c420a9bcd1f033033c1ccd7fe0", diff --git a/dm/DM.cpp b/dm/DM.cpp index 388546d..86baa00 100644 --- a/dm/DM.cpp +++ b/dm/DM.cpp @@ -870,7 +870,6 @@ static Sink* create_via(const SkString& tag, Sink* wrapped) { VIA("sp", ViaSingletonPictures, wrapped); VIA("tiles", ViaTiles, 256, 256, nullptr, wrapped); VIA("tiles_rt", ViaTiles, 256, 256, new SkRTreeFactory, wrapped); - VIA("mojo", ViaMojo, wrapped); if (FLAGS_matrix.count() == 4) { SkMatrix m; diff --git a/dm/DMSrcSink.cpp b/dm/DMSrcSink.cpp index 815a728..c99f326 100644 --- a/dm/DMSrcSink.cpp +++ b/dm/DMSrcSink.cpp @@ -37,10 +37,6 @@ #include "SkAutoCoInitialize.h" #endif -#ifdef SK_MOJO - #include "SkMojo.mojom.h" -#endif - DEFINE_bool(multiPage, false, "For document-type backends, render the source" " into multiple pages"); DEFINE_bool(RAW_threading, true, "Allow RAW decodes to run on multiple threads?"); @@ -1395,55 +1391,6 @@ Error ViaTwice::draw(const Src& src, SkBitmap* bitmap, SkWStream* stream, SkStri /*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/ -#ifdef SK_MOJO - Error ViaMojo::draw(const Src& src, SkBitmap* bitmap, SkWStream* stream, SkString* log) const { - SkPictureRecorder recorder; - SkRect size = SkRect::Make(SkIRect::MakeSize(src.size())); - Error err = src.draw(recorder.beginRecording(size)); - if (!err.isEmpty()) { - return err; - } - sk_sp skPicture(recorder.finishRecordingAsPicture()); - - SkASSERT(skPicture); - SkDynamicMemoryWStream buffer; - skPicture->serialize(&buffer); - skPicture.reset(); - SkMojo::FlattenedPicturePtr mojoPicture = SkMojo::FlattenedPicture::New(); - mojoPicture->data.resize(buffer.bytesWritten()); - buffer.copyTo(mojoPicture->data.data()); - buffer.reset(); - SkASSERT(mojoPicture.get() && mojoPicture->data); - - size_t flatSize = mojoPicture->GetSerializedSize(); - SkAutoMalloc storage(flatSize); - if (!mojoPicture->Serialize(storage.get(), flatSize)) { - return "SkMojo::FlattenedPicture::Serialize failed"; - } - mojoPicture = SkMojo::FlattenedPicture::New(); - mojoPicture->Deserialize(storage.get()); - storage.reset(); - if (!mojoPicture) { - return "SkMojo::FlattenedPicture::Deserialize failed"; - } - SkMemoryStream tmpStream(mojoPicture->data.data(), - mojoPicture->data.size()); - skPicture = SkPicture::MakeFromStream(&tmpStream); - mojoPicture.reset(); - auto fn = [&](SkCanvas* canvas) -> Error { - canvas->drawPicture(skPicture.get()); - return check_against_reference(bitmap, src, fSink); - }; - return draw_to_canvas(fSink, bitmap, stream, log, src.size(), fn); - } -#else // not SK_MOJO - Error ViaMojo::draw(const Src&, SkBitmap*, SkWStream*, SkString*) const { - return "Mojo is missing!"; - } -#endif - -/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/ - // This is like SkRecords::Draw, in that it plays back SkRecords ops into a Canvas. // Unlike SkRecords::Draw, it builds a single-op sub-picture out of each Draw-type op. // This is an only-slightly-exaggerated simluation of Blink's Slimming Paint pictures. diff --git a/experimental/mojo/.gitignore b/experimental/mojo/.gitignore deleted file mode 100644 index 6ac4a17..0000000 --- a/experimental/mojo/.gitignore +++ /dev/null @@ -1,6 +0,0 @@ -*.mojom-* -*.mojom.* -*_mojom.* -dart-gen -go - diff --git a/experimental/mojo/SkMojo.mojom b/experimental/mojo/SkMojo.mojom deleted file mode 100644 index 85b46cc..0000000 --- a/experimental/mojo/SkMojo.mojom +++ /dev/null @@ -1,10 +0,0 @@ -/* - * Copyright 2016 Google Inc. - * - * Use of this source code is governed by a BSD-style license that can be - * found in the LICENSE file. - */ - -module SkMojo; - -struct FlattenedPicture { array data; }; diff --git a/experimental/mojo/generate.py b/experimental/mojo/generate.py deleted file mode 100755 index d57e436..0000000 --- a/experimental/mojo/generate.py +++ /dev/null @@ -1,74 +0,0 @@ -#!/usr/bin/python - -# Copyright 2016 Google Inc. -# -# Use of this source code is governed by a BSD-style license that can be -# found in the LICENSE file. - -import hashlib -import os -import platform -import stat -import subprocess -import sys -import urllib2 - -THIS_DIR = os.path.abspath(os.path.dirname(__file__)) -MOJO_DIR = os.path.abspath(os.path.join(THIS_DIR, '../../third_party/externals/mojo')) - -def GetFile(filename, bucket_directory): - def sha1hash(path): - hasher = hashlib.sha1() - if os.path.isfile(path): - with open(path, 'r') as f: - hasher.update(f.read()) - return hasher.hexdigest() - sha_path = filename + '.sha1' - assert os.path.isfile(sha_path) - with open(sha_path, 'r') as f: - sha = f.read(40) - if sha1hash(filename) == sha: - return - url = 'https://storage.googleapis.com/%s/%s' % (bucket_directory, sha) - with open(filename, 'w') as o: - o.write(urllib2.urlopen(url).read()) - os.chmod(filename, stat.S_IRUSR | stat.S_IRGRP | stat.S_IROTH | - stat.S_IXUSR | stat.S_IXGRP | stat.S_IXOTH) - assert sha1hash(filename) == sha - -def GenerateBindings(path, cdir=None): - system = (platform.machine(), platform.system()) - if ('x86_64', 'Darwin') == system: - parser = 'public/tools/bindings/mojom_parser/bin/mac64/mojom_parser' - bucket_directory = 'mojo/mojom_parser/mac64' - elif ('x86_64', 'Linux') == system: - parser = 'public/tools/bindings/mojom_parser/bin/linux64/mojom_parser' - bucket_directory = 'mojo/mojom_parser/linux64' - else: - assert False - GetFile(os.path.join(MOJO_DIR, parser), bucket_directory) - assert os.path.isfile(path) - path = os.path.abspath(path) - exe = os.path.join( - MOJO_DIR, 'public/tools/bindings/mojom_bindings_generator.py') - assert os.path.isfile(exe) - if cdir is None: - cdir = os.path.dirname(path) - assert os.path.isdir(cdir) - cwd = os.getcwd() - os.chdir(cdir) - subprocess.check_call([exe, os.path.relpath(path, cdir)]) - os.chdir(cwd) - -if __name__ == '__main__': - if 1 == len(sys.argv): - for f in [ - 'public/interfaces/bindings/interface_control_messages.mojom', - 'public/interfaces/application/service_provider.mojom', - 'public/interfaces/bindings/tests/ping_service.mojom', - 'public/interfaces/application/application.mojom', - ]: - GenerateBindings(os.path.join(MOJO_DIR, f), os.path.join(MOJO_DIR, os.pardir)) - else: - for arg in sys.argv[1:]: - GenerateBindings(arg) diff --git a/gyp/common_variables.gypi b/gyp/common_variables.gypi index 7275de2..26dadeb 100644 --- a/gyp/common_variables.gypi +++ b/gyp/common_variables.gypi @@ -38,8 +38,6 @@ 'variables': { # level 1 'angle_path%': '../', - 'skia_mojo%': '0', - 'variables': { # level 2 # Variables needed by conditions list within the level-2 variables dict. 'variables': { # level 3 diff --git a/gyp/dm.gypi b/gyp/dm.gypi index 5a75d85..337bccc 100644 --- a/gyp/dm.gypi +++ b/gyp/dm.gypi @@ -52,6 +52,5 @@ [ 'skia_gpu == 1', { 'dependencies': [ 'gputest.gyp:skgputest' ], }], - [ 'skia_mojo', { 'dependencies': [ 'skmojo.gyp:skmojo' ], } ], ], } diff --git a/gyp/skmojo.gyp b/gyp/skmojo.gyp deleted file mode 100644 index 0bd6f2c..0000000 --- a/gyp/skmojo.gyp +++ /dev/null @@ -1,89 +0,0 @@ -# Copyright 2016 Google Inc. -# -# Use of this source code is governed by a BSD-style license that can be -# found in the LICENSE file. -{ - 'targets': [ - { - 'target_name': 'mojo', - 'type': 'static_library', - 'variables': { 'mojo_parent_dir': '../third_party/externals' }, - 'include_dirs': [ '<(mojo_parent_dir)' ], - 'all_dependent_settings': { 'include_dirs': [ '<(mojo_parent_dir)' ] }, - 'xcode_settings': { 'OTHER_CFLAGS': [ '-w' ], }, - 'sources': [ - '