Bug 77289

Summary: Web Inspector: CodeGeneratorInspector.py: reimplement generated array types
Product: WebKit Reporter: Peter Rybin <prybin>
Component: Web Inspector (Deprecated)Assignee: Nobody <webkit-unassigned>
Status: RESOLVED FIXED    
Severity: Normal CC: apavlov, bweinstein, caseq, joepeck, keishi, loislo, pfeldman, pmuellr, prybin, rik, timothy, vsevik, yurys
Priority: P2    
Version: 528+ (Nightly build)   
Hardware: All   
OS: All   
Bug Depends on:    
Bug Blocks: 72861    
Attachments:
Description Flags
Patch
none
Original InspectorFrontend.h
none
Original InspectorFrontend.cpp
none
New InspectorFrontend.h
none
New InspectorFrontend.cpp
none
Patch
vsevik: review+
New InspectorFrontend.h
none
New InspectorFrontend.cpp none

Peter Rybin
Reported 2012-01-28 14:33:48 PST
Array type should be rendered more of a helper kind, rather than the current first class citizen kind (when it gets its name from parameter name and incapsulates more important item type).
Attachments
Patch (23.25 KB, patch)
2012-01-28 14:48 PST, Peter Rybin
no flags
Original InspectorFrontend.h (167.63 KB, text/plain)
2012-01-28 15:04 PST, Peter Rybin
no flags
Original InspectorFrontend.cpp (41.84 KB, text/plain)
2012-01-28 15:05 PST, Peter Rybin
no flags
New InspectorFrontend.h (160.41 KB, text/plain)
2012-01-28 15:06 PST, Peter Rybin
no flags
New InspectorFrontend.cpp (42.30 KB, text/plain)
2012-01-28 15:06 PST, Peter Rybin
no flags
Patch (22.76 KB, patch)
2012-01-30 15:41 PST, Peter Rybin
vsevik: review+
New InspectorFrontend.h (162.80 KB, text/plain)
2012-01-30 15:43 PST, Peter Rybin
no flags
New InspectorFrontend.cpp (42.36 KB, text/plain)
2012-01-30 15:44 PST, Peter Rybin
no flags
Peter Rybin
Comment 1 2012-01-28 14:48:48 PST
Peter Rybin
Comment 2 2012-01-28 15:04:47 PST
Created attachment 124453 [details] Original InspectorFrontend.h
Peter Rybin
Comment 3 2012-01-28 15:05:17 PST
Created attachment 124454 [details] Original InspectorFrontend.cpp
Peter Rybin
Comment 4 2012-01-28 15:06:04 PST
Created attachment 124455 [details] New InspectorFrontend.h
Peter Rybin
Comment 5 2012-01-28 15:06:34 PST
Created attachment 124456 [details] New InspectorFrontend.cpp
Andrey Kosyakov
Comment 6 2012-01-30 10:10:04 PST
Comment on attachment 124452 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=124452&action=review > Source/WebCore/inspector/CodeGeneratorInspector.py:1580 > +template<typename T> > +class ArrayItemHelper { > +public: > + typedef typename T::ItemTraits Traits; > +}; Why not use T::ItemTraits directly? > Source/WebCore/inspector/CodeGeneratorInspector.py:1583 > +class ArrayOf : public InspectorArray { We don't normally use Of in container type names, e.g. it's map or vector, not mapOf or VectorOf. > Source/WebCore/inspector/CodeGeneratorInspector.py:1609 > +class StructItemTraits { > +public: just struct? > Source/WebCore/inspector/CodeGeneratorInspector.py:1610 > + static void pushRefPtr(InspectorArray* array, PassRefPtr<InspectorObject> value) why do we need to include type into method name, i.e. why not just push()? > Source/WebCore/inspector/CodeGeneratorInspector.py:1618 > + template<typename T> > + static void assertCorrectValue(InspectorValue* value) { > + T::assertCorrectValue(value); > + } Why do we need this wrapper? > Source/WebCore/inspector/CodeGeneratorInspector.py:1625 > +class ArrayItemHelper<String> { > +public: > + class Traits { > + public: just struct? > Source/WebCore/inspector/CodeGeneratorInspector.py:1626 > + static void pushRaw(InspectorArray* array, const String& value) just push()? > Source/WebCore/inspector/CodeGeneratorInspector.py:1637 > +class ArrayItemHelper<InspectorObject> { > +public: > + class Traits { > + public: ditto > Source/WebCore/inspector/CodeGeneratorInspector.py:2115 > + ArrayItemHelper<T>::Traits::template assertCorrectValue<T>(array->get(i).get()); Does this compile?
Peter Rybin
Comment 7 2012-01-30 15:11:36 PST
> > Source/WebCore/inspector/CodeGeneratorInspector.py:1580 > > +template<typename T> > > +class ArrayItemHelper { > > +public: > > + typedef typename T::ItemTraits Traits; > > +}; > Why not use T::ItemTraits directly? This template type is a point where C++ specialization takes part. This class is only a default implementation. I added a comment. > > Source/WebCore/inspector/CodeGeneratorInspector.py:1583 > > +class ArrayOf : public InspectorArray { > We don't normally use Of in container type names, e.g. it's map or vector, not mapOf or VectorOf. Get rid of "of"? It's cleaner? Thanks Sean! :) > > Source/WebCore/inspector/CodeGeneratorInspector.py:1609 > > +class StructItemTraits { > > +public: > just struct? Done > > Source/WebCore/inspector/CodeGeneratorInspector.py:1610 > > + static void pushRefPtr(InspectorArray* array, PassRefPtr<InspectorObject> value) > why do we need to include type into method name, i.e. why not just push()? There is a template/specialization machinery with "T"/"RefPtr<T>" method overloading here, plus the entire code is generated. I would prefer to at least dismiss internal method overloading in favor of keeping it cleaner. So I have 2 explicitly named methods. This is not user-facing. > > Source/WebCore/inspector/CodeGeneratorInspector.py:1618 > > + template<typename T> > > + static void assertCorrectValue(InspectorValue* value) { > > + T::assertCorrectValue(value); > > + } > Why do we need this wrapper? > > Source/WebCore/inspector/CodeGeneratorInspector.py:1625 > > +class ArrayItemHelper<String> { > > +public: > > + class Traits { > > + public: > just struct? Done > > Source/WebCore/inspector/CodeGeneratorInspector.py:1626 > > + static void pushRaw(InspectorArray* array, const String& value) > just push()? See above. > > Source/WebCore/inspector/CodeGeneratorInspector.py:1637 > > +class ArrayItemHelper<InspectorObject> { > > +public: > > + class Traits { > > + public: > ditto Done > > Source/WebCore/inspector/CodeGeneratorInspector.py:2115 > > + ArrayItemHelper<T>::Traits::template assertCorrectValue<T>(array->get(i).get()); > Does this compile? Yes. Why?
Peter Rybin
Comment 8 2012-01-30 15:41:20 PST
Peter Rybin
Comment 9 2012-01-30 15:43:06 PST
Created attachment 124615 [details] New InspectorFrontend.h
Peter Rybin
Comment 10 2012-01-30 15:44:06 PST
Created attachment 124616 [details] New InspectorFrontend.cpp
Andrey Kosyakov
Comment 11 2012-01-31 06:11:14 PST
Comment on attachment 124614 [details] Patch LGTM
Vsevolod Vlasov
Comment 12 2012-01-31 06:59:38 PST
Comment on attachment 124614 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=124614&action=review > Source/WebCore/inspector/CodeGeneratorInspector.py:1712 > + Extra line. > Source/WebCore/inspector/CodeGeneratorInspector.py:2204 > + for (unsigned i = 0; i < array->length(); i++) { Please remove braces.
Vsevolod Vlasov
Comment 13 2012-01-31 07:35:30 PST
Note You need to log in before you can comment on or make changes to this bug.