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

Issue 508073002: IDL: Add PropertyBag class (Closed)

Created:
6 years, 3 months ago by bashi
Modified:
6 years ago
CC:
blink-reviews, blink-reviews-bindings_chromium.org, arv+blink, abarth-chromium
Project:
blink
Visibility:
Public.

Description

IDL: Add PropertyBag class This CL adds PropertyBag class, which is similar to Dictionary{,Helper}, but has some differences. Before this patch, we used DictionaryHelper to get native values from a V8 object in IDL dictionary's toNative(). However, DictionaryHelper::get() returns true when a dictionary member is specified as undefined. Since we want to treat undefined members as 'not specified', we can't use DictionaryHelper to retrive native values. PropertyBag's get() method returns false when a member is undefined or null. BUG=321462

Patch Set 1 #

Total comments: 16

Patch Set 2 : #

Total comments: 3

Patch Set 3 : #

Unified diffs Side-by-side diffs Delta from patch set Stats (+468 lines, -75 lines) Patch
M LayoutTests/fast/dom/idl-dictionary-unittest.html View 1 1 chunk +58 lines, -23 lines 0 comments Download
M LayoutTests/fast/dom/idl-dictionary-unittest-expected.txt View 1 1 chunk +37 lines, -10 lines 0 comments Download
A Source/bindings/core/v8/PropertyBag.h View 1 1 chunk +72 lines, -0 lines 0 comments Download
A Source/bindings/core/v8/PropertyBag.cpp View 1 1 chunk +44 lines, -0 lines 0 comments Download
M Source/bindings/core/v8/v8.gypi View 1 1 chunk +2 lines, -0 lines 0 comments Download
M Source/bindings/scripts/v8_dictionary.py View 1 chunk +1 line, -2 lines 0 comments Download
M Source/bindings/scripts/v8_interface.py View 1 1 chunk +1 line, -0 lines 0 comments Download
M Source/bindings/templates/dictionary_v8.cpp View 1 1 chunk +5 lines, -4 lines 0 comments Download
M Source/bindings/templates/interface.h View 1 1 chunk +5 lines, -0 lines 0 comments Download
M Source/bindings/tests/results/V8SVGTestInterface.h View 1 2 chunks +6 lines, -0 lines 0 comments Download
M Source/bindings/tests/results/V8TestDictionary.cpp View 1 2 chunks +18 lines, -17 lines 0 comments Download
M Source/bindings/tests/results/V8TestException.h View 1 2 chunks +6 lines, -0 lines 0 comments Download
M Source/bindings/tests/results/V8TestInterface.h View 1 2 chunks +6 lines, -0 lines 0 comments Download
M Source/bindings/tests/results/V8TestInterface2.h View 1 2 chunks +6 lines, -0 lines 0 comments Download
M Source/bindings/tests/results/V8TestInterface3.h View 1 2 chunks +6 lines, -0 lines 0 comments Download
M Source/bindings/tests/results/V8TestInterfaceCheckSecurity.h View 1 2 chunks +6 lines, -0 lines 0 comments Download
M Source/bindings/tests/results/V8TestInterfaceConstructor.h View 1 2 chunks +6 lines, -0 lines 0 comments Download
M Source/bindings/tests/results/V8TestInterfaceConstructor2.h View 1 2 chunks +6 lines, -0 lines 0 comments Download
M Source/bindings/tests/results/V8TestInterfaceConstructor3.h View 1 2 chunks +6 lines, -0 lines 0 comments Download
M Source/bindings/tests/results/V8TestInterfaceConstructor4.h View 1 2 chunks +6 lines, -0 lines 0 comments Download
M Source/bindings/tests/results/V8TestInterfaceCustomConstructor.h View 1 2 chunks +6 lines, -0 lines 0 comments Download
M Source/bindings/tests/results/V8TestInterfaceDocument.h View 1 2 chunks +6 lines, -0 lines 0 comments Download
M Source/bindings/tests/results/V8TestInterfaceEmpty.h View 1 2 chunks +6 lines, -0 lines 0 comments Download
M Source/bindings/tests/results/V8TestInterfaceEventConstructor.h View 1 2 chunks +6 lines, -0 lines 0 comments Download
M Source/bindings/tests/results/V8TestInterfaceEventTarget.h View 1 2 chunks +6 lines, -0 lines 0 comments Download
M Source/bindings/tests/results/V8TestInterfaceGarbageCollected.h View 1 2 chunks +6 lines, -0 lines 0 comments Download
M Source/bindings/tests/results/V8TestInterfaceNamedConstructor.h View 1 2 chunks +6 lines, -0 lines 0 comments Download
M Source/bindings/tests/results/V8TestInterfaceNamedConstructor2.h View 1 2 chunks +6 lines, -0 lines 0 comments Download
M Source/bindings/tests/results/V8TestInterfaceNode.h View 1 2 chunks +6 lines, -0 lines 0 comments Download
M Source/bindings/tests/results/V8TestInterfaceNotScriptWrappable.h View 1 2 chunks +6 lines, -0 lines 0 comments Download
M Source/bindings/tests/results/V8TestInterfaceWillBeGarbageCollected.h View 1 2 chunks +6 lines, -0 lines 0 comments Download
M Source/bindings/tests/results/V8TestNode.h View 1 2 chunks +6 lines, -0 lines 0 comments Download
M Source/bindings/tests/results/V8TestObject.h View 1 2 chunks +6 lines, -0 lines 0 comments Download
M Source/bindings/tests/results/V8TestSpecialOperations.h View 1 2 chunks +6 lines, -0 lines 0 comments Download
M Source/bindings/tests/results/V8TestSpecialOperationsNotEnumerable.h View 1 2 chunks +6 lines, -0 lines 0 comments Download
M Source/bindings/tests/results/V8TestTypedefs.h View 1 2 chunks +6 lines, -0 lines 0 comments Download
M Source/core/testing/DictionaryTest.h View 1 2 2 chunks +15 lines, -5 lines 0 comments Download
M Source/core/testing/DictionaryTest.cpp View 1 2 2 chunks +44 lines, -11 lines 0 comments Download
M Source/core/testing/InternalDictionary.idl View 1 1 chunk +10 lines, -3 lines 0 comments Download

Messages

Total messages: 6 (0 generated)
bashi
Hi Haraken-san, This is a follow-up work-in-progress CL to https://codereview.chromium.org/429853002/ What do you think about ...
6 years, 3 months ago (2014-08-27 12:01:34 UTC) #1
bashi
bashi@chromium.org changed reviewers: + haraken@chromium.org, tasak@chromium.org
6 years, 3 months ago (2014-08-27 12:01:52 UTC) #2
bashi
6 years, 3 months ago (2014-08-27 12:01:52 UTC) #3
haraken
It's a shame that we have to duplicate a lot of code between DictionaryHelper and ...
6 years, 3 months ago (2014-08-27 16:07:44 UTC) #4
bashi
PTAL? Yeah, it's a shame to have duplication, but it's somewhat difficult to refactor DictionaryHelper ...
6 years, 3 months ago (2014-08-29 05:21:17 UTC) #5
haraken
6 years, 3 months ago (2014-08-29 05:44:05 UTC) #6
LGTM

https://codereview.chromium.org/508073002/diff/1/Source/bindings/core/v8/Prop...
File Source/bindings/core/v8/PropertyBag.h (right):

https://codereview.chromium.org/508073002/diff/1/Source/bindings/core/v8/Prop...
Source/bindings/core/v8/PropertyBag.h:20: TOSTRING_DEFAULT(V8StringResource<>,
stringValue, v8Value, false);
On 2014/08/29 05:21:17, bashi1 wrote:
> On 2014/08/27 16:07:43, haraken wrote:
> > 
> > This can throw an exception, but is it OK? The same comment for other
> conversion
> > methods like ToInt32, ToBoolean etc.
> 
> Dictionary(Helper) doesn't check exceptions so I thought it is ok. But I'm not
> familiar with how exceptions should be handled in general. Is there any
> guideline for handling exceptions?

I think it's OK to throw an exception here. It's a responsibility of the caller
side to handle the exception.

The current exception system is very complicated and broken in some aspects.
Only Jens and yhirano know how it's working :) This is an area where we should
improve.

https://codereview.chromium.org/508073002/diff/20001/Source/bindings/core/v8/...
File Source/bindings/core/v8/PropertyBag.h (right):

https://codereview.chromium.org/508073002/diff/20001/Source/bindings/core/v8/...
Source/bindings/core/v8/PropertyBag.h:37: if (v8Value.IsEmpty() ||
isUndefinedOrNull(v8Value)) {

Just to confirm: I understand you want to return false when v8Value is
undefined, but you also want to return false when v8Value is null, right?

https://codereview.chromium.org/508073002/diff/20001/Source/bindings/core/v8/...
Source/bindings/core/v8/PropertyBag.h:44: bool
getInternal(v8::Handle<v8::Value>& v8Value, String& value);

Drop |v8Value| and |value|.

Powered by Google App Engine
This is Rietveld 408576698