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

Issue 303613002: Avoid redundant initialization of GraphicsContextState. (Closed)

Created:
6 years, 7 months ago by Dominik Grewe
Modified:
6 years, 6 months ago
CC:
blink-reviews, jamesr, krit, jbroman, danakj, Rik, Stephen Chennney, pdr., rwlbuis, picksi1, Sami
Base URL:
https://chromium.googlesource.com/chromium/blink.git@master
Visibility:
Public.

Description

Avoid redundant initialization of GraphicsContextState. When creating a new GraphicsContextState the constructor initializes the state with various default values. In GraphicsContext::realizePaintState we immediately overwrite these values after creation. This patch adds a copy constructor to GraphicsContextState to avoid that. Even though this seems like a clear win, the benefits are not visible when profiling. Looks like the overhead of the redundant initialization is not very large. Still seems worth fixing though. BUG=377687 Committed: https://src.chromium.org/viewvc/blink?view=rev&revision=174985 Committed: https://src.chromium.org/viewvc/blink?view=rev&revision=175894

Patch Set 1 #

Patch Set 2 : placement new in GraphicsContextState::copy() #

Patch Set 3 : pass pointer instead of ref #

Total comments: 5

Patch Set 4 : pass reference to copy functions #

Total comments: 2

Patch Set 5 : operator= #

Patch Set 6 : rebase #

Unified diffs Side-by-side diffs Delta from patch set Stats (+40 lines, -28 lines) Patch
M Source/platform/graphics/GraphicsContext.h View 1 2 3 4 5 1 chunk +8 lines, -5 lines 0 comments Download
M Source/platform/graphics/GraphicsContextState.h View 1 2 3 4 2 chunks +8 lines, -2 lines 0 comments Download
M Source/platform/graphics/GraphicsContextState.cpp View 1 2 3 1 chunk +24 lines, -21 lines 0 comments Download

Messages

Total messages: 14 (0 generated)
Dominik Grewe
ptal.
6 years, 7 months ago (2014-05-27 17:14:03 UTC) #1
f(malita)
This is likely not showing up in profiles because we're re-using GraphicsContextState stack entries (so ...
6 years, 7 months ago (2014-05-27 18:16:43 UTC) #2
Dominik Grewe
https://codereview.chromium.org/303613002/diff/40001/Source/platform/graphics/GraphicsContextState.h File Source/platform/graphics/GraphicsContextState.h (right): https://codereview.chromium.org/303613002/diff/40001/Source/platform/graphics/GraphicsContextState.h#newcode55 Source/platform/graphics/GraphicsContextState.h:55: static PassOwnPtr<GraphicsContextState> createAndCopy(const GraphicsContextState* other) On 2014/05/27 18:16:44, Florin ...
6 years, 7 months ago (2014-05-27 19:59:21 UTC) #3
Dominik Grewe
On 2014/05/27 19:59:21, Dominik Grewe wrote: > https://codereview.chromium.org/303613002/diff/40001/Source/platform/graphics/GraphicsContextState.h > File Source/platform/graphics/GraphicsContextState.h (right): > > https://codereview.chromium.org/303613002/diff/40001/Source/platform/graphics/GraphicsContextState.h#newcode55 ...
6 years, 6 months ago (2014-05-28 09:25:35 UTC) #4
f(malita)
lgtm https://codereview.chromium.org/303613002/diff/50001/Source/platform/graphics/GraphicsContextState.h File Source/platform/graphics/GraphicsContextState.h (right): https://codereview.chromium.org/303613002/diff/50001/Source/platform/graphics/GraphicsContextState.h#newcode149 Source/platform/graphics/GraphicsContextState.h:149: explicit GraphicsContextState(const GraphicsContextState&); Since we're dropping WTF_MAKE_NONCOPYABLE but ...
6 years, 6 months ago (2014-05-28 12:59:18 UTC) #5
Dominik Grewe
https://codereview.chromium.org/303613002/diff/50001/Source/platform/graphics/GraphicsContextState.h File Source/platform/graphics/GraphicsContextState.h (right): https://codereview.chromium.org/303613002/diff/50001/Source/platform/graphics/GraphicsContextState.h#newcode149 Source/platform/graphics/GraphicsContextState.h:149: explicit GraphicsContextState(const GraphicsContextState&); On 2014/05/28 12:59:19, Florin Malita wrote: ...
6 years, 6 months ago (2014-05-28 14:52:09 UTC) #6
Dominik Grewe
The CQ bit was checked by dominikg@chromium.org
6 years, 6 months ago (2014-05-28 17:25:09 UTC) #7
commit-bot: I haz the power
CQ is trying da patch. Follow status at https://chromium-status.appspot.com/cq/dominikg@chromium.org/303613002/60001
6 years, 6 months ago (2014-05-28 17:25:39 UTC) #8
commit-bot: I haz the power
Change committed as 174985
6 years, 6 months ago (2014-05-28 18:42:31 UTC) #9
Julien - ping for review
A revert of this CL has been created in https://codereview.chromium.org/303403006/ by jchaffraix@chromium.org. The reason for ...
6 years, 6 months ago (2014-05-30 22:15:24 UTC) #10
Dominik Grewe
I couldn't find any evidence that this CL was responsible for the memory leaks. None ...
6 years, 6 months ago (2014-06-10 12:57:32 UTC) #11
Dominik Grewe
The CQ bit was checked by dominikg@chromium.org
6 years, 6 months ago (2014-06-10 12:58:57 UTC) #12
commit-bot: I haz the power
CQ is trying da patch. Follow status at https://chromium-status.appspot.com/cq/dominikg@chromium.org/303613002/80001
6 years, 6 months ago (2014-06-10 12:59:58 UTC) #13
commit-bot: I haz the power
6 years, 6 months ago (2014-06-10 14:11:34 UTC) #14
Message was sent while issue was closed.
Change committed as 175894

Powered by Google App Engine
This is Rietveld 408576698