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

Issue 2918443003: Remove redundant reading and writing of data about SharedBuffer.

Created:
3 years, 6 months ago by Haipeng Liu
Modified:
3 years, 6 months ago
CC:
chromium-reviews, krit, drott+blinkwatch_chromium.org, blink-reviews-platform-graphics_chromium.org, dshwang, pdr+graphicswatchlist_chromium.org, fmalita+watch_chromium.org, Rik, Justin Novosad, blink-reviews, kinuko+watch, Stephen Chennney, rwlbuis
Target Ref:
refs/heads/master
Project:
chromium
Visibility:
Public.

Description

Remove redundant reading and writing of data about SharedBuffer. When decoding an image, the encoding data should be copied from SharedBuffer to SkRWBuffer, and after the data is accepted completed, webcore thread can access the encoded data only by generating SharedBuffer from SkRWBuffer. Obviously, there is redundant reading and writing of data in the above process. Depending on whether the vectors' capacity needs to be expanded, SharedBuffer can be divided into several steps. In step, single thread writing and multi-threaded reading are safe. So only in the step switch, synchronization should be make. This cost is light enough. Moreover, the existing ROBufferSegmentReader also need to add a wide range of lock when reading. In addition, SharedBuffer supports random access, while ROBufferSegmentReader only supports forward or backward access by segment. design doc: https://docs.google.com/document/d/12nBhu8HKjxnuUrfmIhXfTSdPcV1ieCKHmzaAvyOHGM0/edit benchmark results: https://docs.google.com/spreadsheets/d/1ThAJV33yZJMx9tp2CLKZ5tmkomXLJiBM4mfqFFOK4iQ/edit#gid=0 BUG=727995

Patch Set 1 : Remove redundant reading and writing of data about SharedBuffer. #

Patch Set 2 : fix compile error #

Patch Set 3 : use atomic operations instead of mutex lock to synchronize steps and make google test compile pass #

Patch Set 4 : fix bug in GetAsSkData #

Patch Set 5 : benchmark #

Unified diffs Side-by-side diffs Delta from patch set Stats (+1292 lines, -210 lines) Patch
M AUTHORS View 1 2 3 4 1 chunk +1 line, -0 lines 0 comments Download
M third_party/WebKit/Source/core/loader/resource/ImageResource.cpp View 1 2 3 4 1 chunk +0 lines, -6 lines 0 comments Download
M third_party/WebKit/Source/platform/BUILD.gn View 1 2 3 4 2 chunks +24 lines, -0 lines 0 comments Download
M third_party/WebKit/Source/platform/SharedBuffer.h View 1 2 3 4 3 chunks +53 lines, -7 lines 0 comments Download
M third_party/WebKit/Source/platform/SharedBuffer.cpp View 1 2 3 4 5 chunks +171 lines, -147 lines 0 comments Download
A third_party/WebKit/Source/platform/SharedBufferStep.h View 1 2 1 chunk +164 lines, -0 lines 0 comments Download
A third_party/WebKit/Source/platform/SharedBufferStep.cpp View 1 2 3 1 chunk +301 lines, -0 lines 0 comments Download
M third_party/WebKit/Source/platform/graphics/BitmapImage.h View 1 2 3 4 1 chunk +0 lines, -2 lines 0 comments Download
M third_party/WebKit/Source/platform/graphics/BitmapImage.cpp View 1 2 3 4 1 chunk +0 lines, -4 lines 0 comments Download
M third_party/WebKit/Source/platform/graphics/DecodingImageGenerator.h View 3 chunks +13 lines, -1 line 0 comments Download
M third_party/WebKit/Source/platform/graphics/DecodingImageGenerator.cpp View 1 2 3 4 6 chunks +34 lines, -7 lines 0 comments Download
M third_party/WebKit/Source/platform/graphics/DeferredImageDecoder.h View 2 chunks +4 lines, -2 lines 0 comments Download
M third_party/WebKit/Source/platform/graphics/DeferredImageDecoder.cpp View 1 2 3 4 4 chunks +9 lines, -29 lines 0 comments Download
M third_party/WebKit/Source/platform/graphics/ImageSource.h View 1 2 3 4 1 chunk +0 lines, -1 line 0 comments Download
M third_party/WebKit/Source/platform/graphics/ImageSource.cpp View 1 2 3 4 1 chunk +0 lines, -4 lines 0 comments Download
M third_party/WebKit/Source/platform/image-decoders/SegmentReader.h View 2 chunks +4 lines, -0 lines 0 comments Download
M third_party/WebKit/Source/platform/image-decoders/SegmentReader.cpp View 3 chunks +41 lines, -0 lines 0 comments Download
A third_party/WebKit/Source/platform/testing/DeferredImageDecodeBench.cpp View 1 2 3 4 1 chunk +473 lines, -0 lines 0 comments Download

Messages

Total messages: 61 (44 generated)
Haipeng Liu
3 years, 6 months ago (2017-05-31 04:36:59 UTC) #3
hiroshige
+hajimehoshi@.
3 years, 6 months ago (2017-05-31 08:56:03 UTC) #9
Haipeng Liu
3 years, 6 months ago (2017-05-31 09:54:24 UTC) #12
Haipeng Liu
On 2017/05/31 08:56:03, hiroshige wrote: > +hajimehoshi@. I have fixed the compiling error caused by ...
3 years, 6 months ago (2017-05-31 10:05:14 UTC) #18
hajimehoshi
On 2017/05/31 10:05:14, hpeterliu wrote: > On 2017/05/31 08:56:03, hiroshige wrote: > > +hajimehoshi@. > ...
3 years, 6 months ago (2017-05-31 10:09:44 UTC) #21
Haipeng Liu
On 2017/05/31 10:09:44, hajimehoshi wrote: > On 2017/05/31 10:05:14, hpeterliu wrote: > > On 2017/05/31 ...
3 years, 6 months ago (2017-05-31 10:36:19 UTC) #24
Haipeng Liu
3 years, 6 months ago (2017-05-31 11:01:06 UTC) #27
Haipeng Liu
On 2017/05/31 10:09:44, hajimehoshi wrote: > On 2017/05/31 10:05:14, hpeterliu wrote: > > On 2017/05/31 ...
3 years, 6 months ago (2017-05-31 11:30:57 UTC) #28
Haipeng Liu
On 2017/05/31 11:30:57, hpeterliu wrote: > On 2017/05/31 10:09:44, hajimehoshi wrote: > > On 2017/05/31 ...
3 years, 6 months ago (2017-05-31 12:14:49 UTC) #33
f(malita)
Before diving into implementation details, I'd like to understand the motivation and trade-offs. > webcore ...
3 years, 6 months ago (2017-05-31 15:08:28 UTC) #39
Haipeng Liu
On 2017/05/31 15:08:28, f(malita) wrote: > Before diving into implementation details, I'd like to understand ...
3 years, 6 months ago (2017-06-01 09:32:56 UTC) #40
Haipeng Liu
use atomic operations instead of mutex lock to synchronize steps. may somebody can dry CQ ...
3 years, 6 months ago (2017-06-05 10:23:04 UTC) #47
Haipeng Liu
On 2017/05/31 15:08:28, f(malita) wrote: > Before diving into implementation details, I'd like to understand ...
3 years, 6 months ago (2017-06-05 12:03:01 UTC) #49
Haipeng Liu
On 2017/05/31 10:09:44, hajimehoshi wrote: > On 2017/05/31 10:05:14, hpeterliu wrote: > > On 2017/05/31 ...
3 years, 6 months ago (2017-06-06 08:34:37 UTC) #53
Haipeng Liu
A DeferredImageDecodeBench has been added for making Comparison of decoding performance before and after modification. ...
3 years, 6 months ago (2017-06-15 12:03:03 UTC) #57
Haipeng Liu
On 2017/06/15 12:03:03, Haipeng Liu wrote: > A DeferredImageDecodeBench has been added for making > ...
3 years, 6 months ago (2017-06-21 10:13:08 UTC) #60
f(malita)
3 years, 6 months ago (2017-06-22 14:37:39 UTC) #61
On 2017/06/21 10:13:08, Haipeng Liu wrote:
> On 2017/06/15 12:03:03, Haipeng Liu wrote:
> > A DeferredImageDecodeBench has been added for making
> > Comparison of decoding performance before and after modification. According
to
> > the results, The thread-safe SharedBuffer saves writing time, but does not
> > generate additional synchronization costs. So the overall performance has
> > improved slightly. See details in
> >
>
https://docs.google.com/spreadsheets/d/1ThAJV33yZJMx9tp2CLKZ5tmkomXLJiBM4mfqF...
> 
> Would someone can make some suggestions on this issue?

Thank you for the benchmark, looks like we're on the right track.

A significant reason for SharedBuffer's complexity is the data-flattening API -
Data().  We are in the process of attempting to remove that, and convert
existing clients to the sequential/segment-based API:
https://bugs.chromium.org/p/chromium/issues/detail?id=728627

I expect this CL to get much simpler after we remove Data(), so I would suggest
waiting for that refactoring to land first.

Powered by Google App Engine
This is Rietveld 408576698