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

Issue 456683002: bindings: Introduces type-check for the internal pointers. (Closed)

Created:
6 years, 4 months ago by Yuki
Modified:
6 years, 4 months ago
Reviewers:
haraken, Jens Widell
CC:
blink-reviews, arv+blink, sof, eae+blinkwatch, abarth-chromium, blink-reviews-dom_chromium.org, dglazkov+blink, blink-reviews-bindings_chromium.org, rwlbuis
Project:
blink
Visibility:
Public.

Description

bindings: Introduces type-check for the internal pointers. Makes the type of the internal pointers ScriptWrappableBase* so we can check pointer conversions between the internal pointers and the native objects. ScriptWrappableBase* is much safer than void* here because we can avoid unintentional pointer conversions. This CL also includes fixes of misconversions from/to the internal pointers. Note that the definition of the internal pointers does not change by this CL. We'll change the actual definition at the coming http://crrev.com/420233002 . BUG=235436 Committed: https://src.chromium.org/viewvc/blink?view=rev&revision=179915

Patch Set 1 #

Patch Set 2 : #

Total comments: 11

Patch Set 3 : Synced. #

Patch Set 4 : Changed a static_cast to a reinterpret_cast in DOMWrapperMap::set. #

Patch Set 5 : Finally fixed hidden misconversions to internal pointers. #

Total comments: 4

Patch Set 6 : Synced. #

Unified diffs Side-by-side diffs Delta from patch set Stats (+338 lines, -303 lines) Patch
M Source/bindings/core/v8/CustomElementWrapper.cpp View 1 2 3 4 1 chunk +1 line, -1 line 0 comments Download
M Source/bindings/core/v8/DOMWrapperMap.h View 1 2 3 2 chunks +2 lines, -2 lines 0 comments Download
M Source/bindings/core/v8/NPV8Object.h View 2 chunks +3 lines, -0 lines 0 comments Download
M Source/bindings/core/v8/NPV8Object.cpp View 2 chunks +6 lines, -1 line 0 comments Download
M Source/bindings/core/v8/ScriptWrappable.h View 1 chunk +4 lines, -4 lines 0 comments Download
M Source/bindings/core/v8/V8DOMWrapper.h View 3 chunks +14 lines, -13 lines 0 comments Download
M Source/bindings/core/v8/V8DOMWrapper.cpp View 3 chunks +4 lines, -4 lines 0 comments Download
M Source/bindings/core/v8/V8GCController.cpp View 3 chunks +2 lines, -3 lines 0 comments Download
M Source/bindings/core/v8/V8NPObject.cpp View 1 chunk +1 line, -1 line 0 comments Download
M Source/bindings/core/v8/V8WindowShell.cpp View 1 2 3 4 2 chunks +2 lines, -2 lines 0 comments Download
M Source/bindings/core/v8/WrapperTypeInfo.h View 1 6 chunks +12 lines, -16 lines 0 comments Download
M Source/bindings/core/v8/custom/V8ArrayBufferCustom.h View 1 chunk +5 lines, -5 lines 0 comments Download
M Source/bindings/core/v8/custom/V8ArrayBufferCustom.cpp View 3 chunks +4 lines, -4 lines 0 comments Download
M Source/bindings/core/v8/custom/V8MutationObserverCustom.cpp View 1 chunk +2 lines, -2 lines 0 comments Download
M Source/bindings/core/v8/custom/V8TypedArrayCustom.h View 3 chunks +10 lines, -5 lines 0 comments Download
M Source/bindings/scripts/v8_interface.py View 1 2 1 chunk +1 line, -0 lines 0 comments Download
M Source/bindings/templates/interface.h View 1 2 2 chunks +8 lines, -8 lines 0 comments Download
M Source/bindings/templates/interface.cpp View 4 chunks +7 lines, -7 lines 0 comments Download
M Source/bindings/tests/results/V8SVGTestInterface.h View 1 2 chunks +7 lines, -6 lines 0 comments Download
M Source/bindings/tests/results/V8SVGTestInterface.cpp View 2 chunks +3 lines, -3 lines 0 comments Download
M Source/bindings/tests/results/V8TestException.h View 1 2 chunks +7 lines, -6 lines 0 comments Download
M Source/bindings/tests/results/V8TestException.cpp View 2 chunks +3 lines, -3 lines 0 comments Download
M Source/bindings/tests/results/V8TestInterface.h View 1 2 2 chunks +7 lines, -6 lines 0 comments Download
M Source/bindings/tests/results/V8TestInterface.cpp View 1 2 4 chunks +6 lines, -6 lines 0 comments Download
M Source/bindings/tests/results/V8TestInterface2.h View 1 2 chunks +8 lines, -7 lines 0 comments Download
M Source/bindings/tests/results/V8TestInterface2.cpp View 3 chunks +6 lines, -6 lines 0 comments Download
M Source/bindings/tests/results/V8TestInterface3.h View 1 3 chunks +8 lines, -7 lines 0 comments Download
M Source/bindings/tests/results/V8TestInterface3.cpp View 2 chunks +3 lines, -3 lines 0 comments Download
M Source/bindings/tests/results/V8TestInterfaceCheckSecurity.h View 1 2 chunks +7 lines, -6 lines 0 comments Download
M Source/bindings/tests/results/V8TestInterfaceCheckSecurity.cpp View 2 chunks +3 lines, -3 lines 0 comments Download
M Source/bindings/tests/results/V8TestInterfaceConstructor.h View 1 2 chunks +7 lines, -6 lines 0 comments Download
M Source/bindings/tests/results/V8TestInterfaceConstructor.cpp View 2 chunks +3 lines, -3 lines 0 comments Download
M Source/bindings/tests/results/V8TestInterfaceConstructor2.h View 1 2 chunks +7 lines, -6 lines 0 comments Download
M Source/bindings/tests/results/V8TestInterfaceConstructor2.cpp View 2 chunks +3 lines, -3 lines 0 comments Download
M Source/bindings/tests/results/V8TestInterfaceConstructor3.h View 1 2 chunks +7 lines, -6 lines 0 comments Download
M Source/bindings/tests/results/V8TestInterfaceConstructor3.cpp View 2 chunks +3 lines, -3 lines 0 comments Download
M Source/bindings/tests/results/V8TestInterfaceConstructor4.h View 1 2 chunks +7 lines, -6 lines 0 comments Download
M Source/bindings/tests/results/V8TestInterfaceConstructor4.cpp View 2 chunks +3 lines, -3 lines 0 comments Download
M Source/bindings/tests/results/V8TestInterfaceCustomConstructor.h View 1 2 chunks +7 lines, -6 lines 0 comments Download
M Source/bindings/tests/results/V8TestInterfaceCustomConstructor.cpp View 2 chunks +3 lines, -3 lines 0 comments Download
M Source/bindings/tests/results/V8TestInterfaceDocument.h View 1 3 chunks +6 lines, -5 lines 0 comments Download
M Source/bindings/tests/results/V8TestInterfaceDocument.cpp View 2 chunks +3 lines, -3 lines 0 comments Download
M Source/bindings/tests/results/V8TestInterfaceEmpty.h View 1 2 chunks +7 lines, -6 lines 0 comments Download
M Source/bindings/tests/results/V8TestInterfaceEmpty.cpp View 2 chunks +3 lines, -3 lines 0 comments Download
M Source/bindings/tests/results/V8TestInterfaceEventConstructor.h View 1 3 chunks +6 lines, -5 lines 0 comments Download
M Source/bindings/tests/results/V8TestInterfaceEventConstructor.cpp View 2 chunks +3 lines, -3 lines 0 comments Download
M Source/bindings/tests/results/V8TestInterfaceEventTarget.h View 1 3 chunks +6 lines, -5 lines 0 comments Download
M Source/bindings/tests/results/V8TestInterfaceEventTarget.cpp View 2 chunks +3 lines, -3 lines 0 comments Download
M Source/bindings/tests/results/V8TestInterfaceGarbageCollected.h View 1 2 chunks +6 lines, -5 lines 0 comments Download
M Source/bindings/tests/results/V8TestInterfaceGarbageCollected.cpp View 2 chunks +2 lines, -2 lines 0 comments Download
M Source/bindings/tests/results/V8TestInterfaceNamedConstructor.h View 1 2 chunks +7 lines, -6 lines 0 comments Download
M Source/bindings/tests/results/V8TestInterfaceNamedConstructor.cpp View 2 chunks +3 lines, -3 lines 0 comments Download
M Source/bindings/tests/results/V8TestInterfaceNamedConstructor2.h View 1 2 chunks +7 lines, -6 lines 0 comments Download
M Source/bindings/tests/results/V8TestInterfaceNamedConstructor2.cpp View 2 chunks +3 lines, -3 lines 0 comments Download
M Source/bindings/tests/results/V8TestInterfaceNode.h View 1 3 chunks +6 lines, -5 lines 0 comments Download
M Source/bindings/tests/results/V8TestInterfaceNode.cpp View 2 chunks +3 lines, -3 lines 0 comments Download
M Source/bindings/tests/results/V8TestInterfaceWillBeGarbageCollected.h View 1 3 chunks +6 lines, -5 lines 0 comments Download
M Source/bindings/tests/results/V8TestInterfaceWillBeGarbageCollected.cpp View 2 chunks +3 lines, -3 lines 0 comments Download
M Source/bindings/tests/results/V8TestNode.h View 1 3 chunks +6 lines, -5 lines 0 comments Download
M Source/bindings/tests/results/V8TestNode.cpp View 2 chunks +3 lines, -3 lines 0 comments Download
M Source/bindings/tests/results/V8TestObject.h View 1 2 3 chunks +7 lines, -6 lines 0 comments Download
M Source/bindings/tests/results/V8TestObject.cpp View 1 2 2 chunks +3 lines, -3 lines 0 comments Download
M Source/bindings/tests/results/V8TestSpecialOperations.h View 1 2 chunks +7 lines, -6 lines 0 comments Download
M Source/bindings/tests/results/V8TestSpecialOperations.cpp View 2 chunks +3 lines, -3 lines 0 comments Download
M Source/bindings/tests/results/V8TestSpecialOperationsNotEnumerable.h View 1 2 chunks +7 lines, -6 lines 0 comments Download
M Source/bindings/tests/results/V8TestSpecialOperationsNotEnumerable.cpp View 2 chunks +3 lines, -3 lines 0 comments Download
M Source/bindings/tests/results/V8TestTypedefs.h View 1 2 chunks +7 lines, -6 lines 0 comments Download
M Source/bindings/tests/results/V8TestTypedefs.cpp View 2 chunks +3 lines, -3 lines 0 comments Download

Messages

Total messages: 25 (0 generated)
Yuki
Could you review this CL? void* is ... dangerous! It's really dangerous...
6 years, 4 months ago (2014-08-08 08:56:36 UTC) #1
Jens Widell
https://codereview.chromium.org/456683002/diff/20001/Source/bindings/core/v8/DOMWrapperMap.h File Source/bindings/core/v8/DOMWrapperMap.h (right): https://codereview.chromium.org/456683002/diff/20001/Source/bindings/core/v8/DOMWrapperMap.h#newcode145 Source/bindings/core/v8/DOMWrapperMap.h:145: return reinterpret_cast<KeyType*>(toInternalPointer(data.GetValue())); Why use reinterpret_cast here? If KeyType is ...
6 years, 4 months ago (2014-08-08 09:37:07 UTC) #2
haraken
This is a great CL. https://codereview.chromium.org/456683002/diff/20001/Source/bindings/core/v8/custom/V8ArrayBufferCustom.h File Source/bindings/core/v8/custom/V8ArrayBufferCustom.h (right): https://codereview.chromium.org/456683002/diff/20001/Source/bindings/core/v8/custom/V8ArrayBufferCustom.h#newcode65 Source/bindings/core/v8/custom/V8ArrayBufferCustom.h:65: return reinterpret_cast<ScriptWrappableBase*>(impl); Probably I'm ...
6 years, 4 months ago (2014-08-08 09:37:24 UTC) #3
haraken
Nit: Wrap the CL description to 80 characters or so.
6 years, 4 months ago (2014-08-08 09:38:03 UTC) #4
Jens Widell
On 2014/08/08 09:38:03, haraken wrote: > Nit: Wrap the CL description to 80 characters or ...
6 years, 4 months ago (2014-08-08 09:50:13 UTC) #5
Yuki
Thanks for the review. By the way, I think that recently Rietveld's behavior changed so ...
6 years, 4 months ago (2014-08-08 13:01:25 UTC) #6
Yuki
I agree that "reinterpret_cast" is a useful signal to detect that we're doing something in ...
6 years, 4 months ago (2014-08-08 13:07:00 UTC) #7
haraken
> I agree that "reinterpret_cast" is a useful signal to detect that we're doing > ...
6 years, 4 months ago (2014-08-08 13:14:30 UTC) #8
Yuki
On 2014/08/08 13:14:30, haraken wrote: > > I agree that "reinterpret_cast" is a useful signal ...
6 years, 4 months ago (2014-08-08 13:21:20 UTC) #9
haraken
Looks like the patch set 3 doesn't compile on try bots... :)
6 years, 4 months ago (2014-08-08 13:27:28 UTC) #10
Yuki
On 2014/08/08 13:27:28, haraken wrote: > Looks like the patch set 3 doesn't compile on ...
6 years, 4 months ago (2014-08-08 15:15:08 UTC) #11
haraken
The code change looks OK. However, I want to add some verification to verify that ...
6 years, 4 months ago (2014-08-08 15:50:31 UTC) #12
Yuki
https://codereview.chromium.org/456683002/diff/80001/Source/bindings/core/v8/CustomElementWrapper.cpp File Source/bindings/core/v8/CustomElementWrapper.cpp (right): https://codereview.chromium.org/456683002/diff/80001/Source/bindings/core/v8/CustomElementWrapper.cpp#newcode104 Source/bindings/core/v8/CustomElementWrapper.cpp:104: v8::Handle<v8::Object> wrapper = V8DOMWrapper::createWrapper(creationContext, binding->wrapperType(), WrapperType::toInternalPointer(element.get()), isolate); On 2014/08/08 ...
6 years, 4 months ago (2014-08-11 05:42:00 UTC) #13
haraken
On 2014/08/11 05:42:00, Yuki wrote: > https://codereview.chromium.org/456683002/diff/80001/Source/bindings/core/v8/CustomElementWrapper.cpp > File Source/bindings/core/v8/CustomElementWrapper.cpp (right): > > https://codereview.chromium.org/456683002/diff/80001/Source/bindings/core/v8/CustomElementWrapper.cpp#newcode104 > ...
6 years, 4 months ago (2014-08-11 05:44:24 UTC) #14
Yuki
On 2014/08/11 05:44:24, haraken wrote: > On 2014/08/11 05:42:00, Yuki wrote: > > > https://codereview.chromium.org/456683002/diff/80001/Source/bindings/core/v8/CustomElementWrapper.cpp ...
6 years, 4 months ago (2014-08-11 05:46:29 UTC) #15
Yuki
On 2014/08/11 05:46:29, Yuki wrote: > On 2014/08/11 05:44:24, haraken wrote: > > On 2014/08/11 ...
6 years, 4 months ago (2014-08-11 05:50:08 UTC) #16
Yuki
The CQ bit was checked by yukishiino@chromium.org
6 years, 4 months ago (2014-08-11 05:50:25 UTC) #17
commit-bot: I haz the power
CQ is trying da patch. Follow status at https://chromium-status.appspot.com/cq/yukishiino@chromium.org/456683002/80001
6 years, 4 months ago (2014-08-11 05:51:12 UTC) #18
commit-bot: I haz the power
The CQ bit was unchecked by commit-bot@chromium.org
6 years, 4 months ago (2014-08-11 05:52:03 UTC) #19
commit-bot: I haz the power
Failed to apply patch for Source/bindings/core/v8/custom/V8InjectedScriptManager.cpp: While running patch -p1 --forward --force --no-backup-if-mismatch; patching file ...
6 years, 4 months ago (2014-08-11 05:52:04 UTC) #20
Jens Widell
On 2014/08/11 05:50:08, Yuki wrote: > Jens (jl@), please feel free to send me your ...
6 years, 4 months ago (2014-08-11 05:55:52 UTC) #21
Yuki
The CQ bit was checked by yukishiino@chromium.org
6 years, 4 months ago (2014-08-11 06:22:41 UTC) #22
commit-bot: I haz the power
CQ is trying da patch. Follow status at https://chromium-status.appspot.com/cq/yukishiino@chromium.org/456683002/100001
6 years, 4 months ago (2014-08-11 06:23:19 UTC) #23
commit-bot: I haz the power
FYI, CQ is re-trying this CL (attempt #1). The failing builders are: win_blink_compile_dbg on tryserver.blink ...
6 years, 4 months ago (2014-08-11 07:32:13 UTC) #24
commit-bot: I haz the power
6 years, 4 months ago (2014-08-11 08:00:24 UTC) #25
Message was sent while issue was closed.
Change committed as 179915

Powered by Google App Engine
This is Rietveld 408576698