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

Issue 1135363002: Defer execution of SkPicture::Analysis::Analysis

Created:
5 years, 7 months ago by junchao.han
Modified:
5 years, 7 months ago
Reviewers:
mtklein
CC:
reviews_skia.org, bsalomon
Base URL:
https://chromium.googlesource.com/skia.git@master
Target Ref:
refs/heads/master
Project:
skia
Visibility:
Public.

Description

Defer execution of SkPicture::Analysis::Analysis Currently SkPicture will be analyzed at CTOR, which can be deferred before execution of SkPicture::suitableForGpuRasterization. If the later is not called, analysis process can be saved. For example with this modification, score of BrowserMark 2.1 SVG case will improve 10% on Galaxy S5. BUG=skia:

Patch Set 1 #

Unified diffs Side-by-side diffs Delta from patch set Stats (+14 lines, -2 lines) Patch
M include/core/SkPicture.h View 2 chunks +4 lines, -1 line 0 comments Download
M src/core/SkPicture.cpp View 3 chunks +10 lines, -1 line 0 comments Download

Messages

Total messages: 4 (2 generated)
junchao.han
On 2015/05/13 03:04:27, junchao.han wrote: > mailto:junchao.han@intel.com changed reviewers: > + mailto:bsalomon@google.com PTAL
5 years, 7 months ago (2015-05-13 05:34:43 UTC) #2
mtklein
5 years, 7 months ago (2015-05-13 13:30:28 UTC) #4
SkPicture::hasText() and SkPicture::willPlayBackBitmaps() are using fAnalysis
too, and so will return uninitialized data unless someone's called
SkPicture::suitableForGpuRasterization() first.

We have a mechanism called SkLazyPtr that should be suitable for delaying this
analysis until it's first needed.  I'd try something like this:

SkPicture.h:
   ...
   struct Analysis { Analysis(const SkRecord&) { ... } ... };
   SkLazyPtr<Analysis> fAnalysis;
   const Analysis& analysis() const;
   ...

SkPicture.cpp:
   const SkPicture::Analysis& SkPicture::analysis() const {
      auto create = [&]() { return SkNEW_ARGS(Analysis, (*fRecord)); };
      return *fAnalysis.get(create);
   }
   ...
   bool SkPicture::suitableForGpuRasterization(GrContext*, const char **reason)
const { 
     return this->analysis().suitableForGpuRasterization(reason, 0);
   }
   ...
   bool SkPicture::hasText() const {
     return this->analysis().hasText();
   }
   ....
   bool SkPicture::willPlayBackBitmaps() const {
     return this->analysis().willPlayBackBitmaps();
   }
   ...

Powered by Google App Engine
This is Rietveld 408576698