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

Issue 2741793003: Accurate transfer of SerializedScriptValue allocation costs. (Closed)

Created:
3 years, 9 months ago by sof
Modified:
3 years, 9 months ago
Reviewers:
haraken, jbroman
CC:
blink-reviews, blink-reviews-bindings_chromium.org, blink-reviews-wtf_chromium.org, chromium-reviews, jbroman+watch_chromium.org, Mikhail
Target Ref:
refs/pending/heads/master
Project:
chromium
Visibility:
Public.

Description

Accurate transfer of SerializedScriptValue allocation costs. r456009 added transferring of allocation costs for a SerializedScriptValue and any array buffers that it refers to, transferring that cost from one v8 context to another as part of a postMessage() The handoff 'protocol' provided there fell short in that it could fail to subtract transferable (array buffer contents) costs in the source context, or end up doing it twice if the postMessage() failed. Bookkeeping confusion resulted. Rework the mechanism by instead having ArrayBufferContents keep track of its external allocation cost registration status, so as to prevent double discounting. Along with that, it is both safe and accurate to unregister all allocation costs prior to transfer. Should the value successfully be posted to its target context, cost will be registered there. And if not, the value will be destructed (..but without discounting allocation cost yet again.) R=jbroman,haraken BUG=700353 Review-Url: https://codereview.chromium.org/2741793003 Cr-Commit-Position: refs/heads/master@{#456800} Committed: https://chromium.googlesource.com/chromium/src/+/e75f1381dccdeef00b30479ad55432f60ee8db7d

Patch Set 1 #

Total comments: 1

Patch Set 2 : make postMessage() return status instead #

Patch Set 3 : update comment #

Patch Set 4 : V8WindowCustom updated #

Patch Set 5 : simplify, revert postMessage() status tracking #

Total comments: 2

Patch Set 6 : pre-post, unregister all cost (and record) #

Patch Set 7 : address (un)signed warnings #

Total comments: 2

Patch Set 8 : sanity check diff adjustments #

Unified diffs Side-by-side diffs Delta from patch set Stats (+76 lines, -70 lines) Patch
M third_party/WebKit/Source/bindings/core/v8/SerializedScriptValue.h View 1 2 3 4 5 2 chunks +10 lines, -9 lines 0 comments Download
M third_party/WebKit/Source/bindings/core/v8/SerializedScriptValue.cpp View 1 2 3 4 5 3 chunks +27 lines, -35 lines 0 comments Download
M third_party/WebKit/Source/bindings/core/v8/custom/V8WindowCustom.cpp View 1 2 3 4 5 1 chunk +1 line, -1 line 0 comments Download
M third_party/WebKit/Source/bindings/templates/methods.cpp.tmpl View 1 2 3 4 5 1 chunk +1 line, -1 line 0 comments Download
M third_party/WebKit/Source/bindings/tests/results/core/V8TestObject.cpp View 1 2 3 4 5 6 7 1 chunk +1 line, -1 line 0 comments Download
M third_party/WebKit/Source/wtf/typed_arrays/ArrayBufferContents.h View 1 2 3 4 5 6 7 3 chunks +14 lines, -21 lines 0 comments Download
M third_party/WebKit/Source/wtf/typed_arrays/ArrayBufferContents.cpp View 1 2 3 4 5 6 5 chunks +22 lines, -2 lines 0 comments Download

Messages

Total messages: 61 (40 generated)
sof
please take a look. TSan is an invaluable tool, I wish I was equally circumspect ...
3 years, 9 months ago (2017-03-10 15:20:59 UTC) #4
jbroman
https://codereview.chromium.org/2741793003/diff/1/third_party/WebKit/Source/bindings/core/v8/SerializedScriptValue.cpp File third_party/WebKit/Source/bindings/core/v8/SerializedScriptValue.cpp (right): https://codereview.chromium.org/2741793003/diff/1/third_party/WebKit/Source/bindings/core/v8/SerializedScriptValue.cpp#newcode475 third_party/WebKit/Source/bindings/core/v8/SerializedScriptValue.cpp:475: if (hasOneRef()) I'm not thrilled by using |hasOneRef| to ...
3 years, 9 months ago (2017-03-10 20:08:05 UTC) #8
sof
On 2017/03/10 20:08:05, jbroman wrote: > https://codereview.chromium.org/2741793003/diff/1/third_party/WebKit/Source/bindings/core/v8/SerializedScriptValue.cpp > File third_party/WebKit/Source/bindings/core/v8/SerializedScriptValue.cpp > (right): > > https://codereview.chromium.org/2741793003/diff/1/third_party/WebKit/Source/bindings/core/v8/SerializedScriptValue.cpp#newcode475 ...
3 years, 9 months ago (2017-03-10 20:50:26 UTC) #9
jbroman
On 2017/03/10 at 20:50:26, sigbjornf wrote: > On 2017/03/10 20:08:05, jbroman wrote: > > https://codereview.chromium.org/2741793003/diff/1/third_party/WebKit/Source/bindings/core/v8/SerializedScriptValue.cpp ...
3 years, 9 months ago (2017-03-10 21:05:45 UTC) #10
sof
On 2017/03/10 21:05:45, jbroman wrote: > On 2017/03/10 at 20:50:26, sigbjornf wrote: > > On ...
3 years, 9 months ago (2017-03-11 07:58:53 UTC) #13
sof
Thinking this through over the weekend, I realized that it is needlessly general to track ...
3 years, 9 months ago (2017-03-13 13:29:00 UTC) #25
jbroman
https://codereview.chromium.org/2741793003/diff/80001/third_party/WebKit/Source/bindings/core/v8/SerializedScriptValue.cpp File third_party/WebKit/Source/bindings/core/v8/SerializedScriptValue.cpp (right): https://codereview.chromium.org/2741793003/diff/80001/third_party/WebKit/Source/bindings/core/v8/SerializedScriptValue.cpp#newcode469 third_party/WebKit/Source/bindings/core/v8/SerializedScriptValue.cpp:469: void SerializedScriptValue::finalizeTransferringContext() { Why do we believe registerMemoryAllocatedWithCurrentScriptContext will ...
3 years, 9 months ago (2017-03-13 15:01:14 UTC) #26
sof
https://codereview.chromium.org/2741793003/diff/80001/third_party/WebKit/Source/bindings/core/v8/SerializedScriptValue.cpp File third_party/WebKit/Source/bindings/core/v8/SerializedScriptValue.cpp (right): https://codereview.chromium.org/2741793003/diff/80001/third_party/WebKit/Source/bindings/core/v8/SerializedScriptValue.cpp#newcode469 third_party/WebKit/Source/bindings/core/v8/SerializedScriptValue.cpp:469: void SerializedScriptValue::finalizeTransferringContext() { On 2017/03/13 15:01:14, jbroman wrote: > ...
3 years, 9 months ago (2017-03-13 15:10:49 UTC) #29
jbroman
On 2017/03/13 at 15:10:49, sigbjornf wrote: > https://codereview.chromium.org/2741793003/diff/80001/third_party/WebKit/Source/bindings/core/v8/SerializedScriptValue.cpp > File third_party/WebKit/Source/bindings/core/v8/SerializedScriptValue.cpp (right): > > https://codereview.chromium.org/2741793003/diff/80001/third_party/WebKit/Source/bindings/core/v8/SerializedScriptValue.cpp#newcode469 ...
3 years, 9 months ago (2017-03-13 15:45:52 UTC) #30
sof
On 2017/03/13 15:45:52, jbroman wrote: > On 2017/03/13 at 15:10:49, sigbjornf wrote: > > > ...
3 years, 9 months ago (2017-03-13 16:04:03 UTC) #31
jbroman
On 2017/03/13 at 16:04:03, sigbjornf wrote: > On 2017/03/13 15:45:52, jbroman wrote: > > On ...
3 years, 9 months ago (2017-03-13 18:09:56 UTC) #32
sof
On 2017/03/13 18:09:56, jbroman wrote: > On 2017/03/13 at 16:04:03, sigbjornf wrote: > > On ...
3 years, 9 months ago (2017-03-14 11:41:16 UTC) #41
jbroman
lgtm https://codereview.chromium.org/2741793003/diff/120001/third_party/WebKit/Source/wtf/typed_arrays/ArrayBufferContents.h File third_party/WebKit/Source/wtf/typed_arrays/ArrayBufferContents.h (right): https://codereview.chromium.org/2741793003/diff/120001/third_party/WebKit/Source/wtf/typed_arrays/ArrayBufferContents.h#newcode144 third_party/WebKit/Source/wtf/typed_arrays/ArrayBufferContents.h:144: m_hasRegisteredExternalAllocation = !m_hasRegisteredExternalAllocation; nit: sanity DCHECK that this ...
3 years, 9 months ago (2017-03-14 15:43:33 UTC) #42
jbroman
3 years, 9 months ago (2017-03-14 15:43:36 UTC) #43
sof
thanks, hope that proves a stable base for cost transfer. One too many iterations required ...
3 years, 9 months ago (2017-03-14 16:51:39 UTC) #45
haraken
LGTM
3 years, 9 months ago (2017-03-14 16:55:22 UTC) #47
jbroman
Thanks for your patience. :) Please update the CL description before landing.
3 years, 9 months ago (2017-03-14 18:01:19 UTC) #48
sof
On 2017/03/14 18:01:19, jbroman wrote: > Thanks for your patience. :) > > Please update ...
3 years, 9 months ago (2017-03-14 19:01:10 UTC) #52
commit-bot: I haz the power
CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/v2/patch-status/codereview.chromium.org/2741793003/140001
3 years, 9 months ago (2017-03-14 19:02:34 UTC) #55
commit-bot: I haz the power
CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/v2/patch-status/codereview.chromium.org/2741793003/140001
3 years, 9 months ago (2017-03-14 19:53:26 UTC) #58
commit-bot: I haz the power
3 years, 9 months ago (2017-03-14 20:05:36 UTC) #61
Message was sent while issue was closed.
Committed patchset #8 (id:140001) as
https://chromium.googlesource.com/chromium/src/+/e75f1381dccdeef00b30479ad554...

Powered by Google App Engine
This is Rietveld 408576698