Web Inspector: CodeGeneratorInspector.py: stop accepting raw InspectorObject in gener...
authorpfeldman@chromium.org <pfeldman@chromium.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 6 Apr 2012 15:23:25 +0000 (15:23 +0000)
committerpfeldman@chromium.org <pfeldman@chromium.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 6 Apr 2012 15:23:25 +0000 (15:23 +0000)
https://bugs.webkit.org/show_bug.cgi?id=83327

Patch by Peter Rybin <peter.rybin@gmail.com> on 2012-04-06
Reviewed by Pavel Feldman.

Generator fixed to have strict types in generated setter methods.

Client code is switched from InspectorObject's and String's to generated types where
needed.

* inspector/CodeGeneratorInspector.py:
(AdHocTypeContext):
(format_setter_value_expression):
* inspector/ConsoleMessage.cpp:
(WebCore::messageSourceValue):
(WebCore::messageTypeValue):
(WebCore::messageLevelValue):
(WebCore::ConsoleMessage::addToFrontend):
* inspector/InspectorApplicationCacheAgent.cpp:
(WebCore::InspectorApplicationCacheAgent::buildArrayForApplicationCacheResources):
(WebCore::InspectorApplicationCacheAgent::buildObjectForApplicationCacheResource):
* inspector/InspectorApplicationCacheAgent.h:
(InspectorApplicationCacheAgent):
* inspector/InspectorCSSAgent.cpp:
(WebCore::InspectorCSSAgent::asInspectorStyleSheet):
(WebCore::InspectorCSSAgent::viaInspectorStyleSheet):
(WebCore::InspectorCSSAgent::detectOrigin):
* inspector/InspectorCSSAgent.h:
(InspectorCSSAgent):
* inspector/InspectorDOMAgent.cpp:
(WebCore::InspectorDOMAgent::buildObjectForNode):
* inspector/InspectorIndexedDBAgent.cpp:
(WebCore):
* inspector/InspectorMemoryAgent.cpp:
* inspector/InspectorPageAgent.cpp:
(WebCore::InspectorPageAgent::buildObjectForFrameTree):
* inspector/InspectorResourceAgent.cpp:
(WebCore::buildObjectForTiming):
(WebCore::buildObjectForCachedResource):
* inspector/InspectorStyleSheet.cpp:
(WebCore::InspectorStyle::buildObjectForStyle):
(WebCore::InspectorStyleSheet::create):
(WebCore::InspectorStyleSheet::InspectorStyleSheet):
(WebCore::InspectorStyleSheet::buildObjectForRule):
(WebCore::InspectorStyleSheet::resourceStyleSheetText):
(WebCore::InspectorStyleSheet::buildArrayForRuleList):
(WebCore::InspectorStyleSheetForInlineStyle::create):
(WebCore::InspectorStyleSheetForInlineStyle::InspectorStyleSheetForInlineStyle):
* inspector/InspectorStyleSheet.h:
(InspectorCSSId):
(WebCore::InspectorCSSId::asProtocolValue): method is made template as now it returns 2 formally different types.
(InspectorStyleSheet):
(WebCore::InspectorStyleSheet::canBind):
(InspectorStyleSheetForInlineStyle):

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@113438 268f45cc-cd09-0410-ab3c-d52691b4dbfc

14 files changed:
Source/WebCore/ChangeLog
Source/WebCore/inspector/CodeGeneratorInspector.py
Source/WebCore/inspector/ConsoleMessage.cpp
Source/WebCore/inspector/InspectorApplicationCacheAgent.cpp
Source/WebCore/inspector/InspectorApplicationCacheAgent.h
Source/WebCore/inspector/InspectorCSSAgent.cpp
Source/WebCore/inspector/InspectorCSSAgent.h
Source/WebCore/inspector/InspectorDOMAgent.cpp
Source/WebCore/inspector/InspectorIndexedDBAgent.cpp
Source/WebCore/inspector/InspectorMemoryAgent.cpp
Source/WebCore/inspector/InspectorPageAgent.cpp
Source/WebCore/inspector/InspectorResourceAgent.cpp
Source/WebCore/inspector/InspectorStyleSheet.cpp
Source/WebCore/inspector/InspectorStyleSheet.h

index 6d0a83b..e059b90 100644 (file)
@@ -1,3 +1,77 @@
+2012-04-06  Peter Rybin  <peter.rybin@gmail.com>
+
+        Web Inspector: CodeGeneratorInspector.py: stop accepting raw InspectorObject in generated setters
+        https://bugs.webkit.org/show_bug.cgi?id=83327
+
+        Reviewed by Pavel Feldman.
+
+        Generator fixed to have strict types in generated setter methods.
+
+        Client code is switched from InspectorObject's and String's to generated types where
+        needed.
+
+        * inspector/CodeGeneratorInspector.py:
+        (AdHocTypeContext):
+        (format_setter_value_expression):
+        * inspector/ConsoleMessage.cpp:
+        (WebCore::messageSourceValue):
+        (WebCore::messageTypeValue):
+        (WebCore::messageLevelValue):
+        (WebCore::ConsoleMessage::addToFrontend):
+        * inspector/InspectorApplicationCacheAgent.cpp:
+        (WebCore::InspectorApplicationCacheAgent::buildArrayForApplicationCacheResources):
+        (WebCore::InspectorApplicationCacheAgent::buildObjectForApplicationCacheResource):
+        * inspector/InspectorApplicationCacheAgent.h:
+        (InspectorApplicationCacheAgent):
+        * inspector/InspectorCSSAgent.cpp:
+        (WebCore::InspectorCSSAgent::asInspectorStyleSheet):
+        (WebCore::InspectorCSSAgent::viaInspectorStyleSheet):
+        (WebCore::InspectorCSSAgent::detectOrigin):
+        * inspector/InspectorCSSAgent.h:
+        (InspectorCSSAgent):
+        * inspector/InspectorDOMAgent.cpp:
+        (WebCore::InspectorDOMAgent::buildObjectForNode):
+        * inspector/InspectorIndexedDBAgent.cpp:
+        (WebCore):
+        * inspector/InspectorMemoryAgent.cpp:
+        * inspector/InspectorPageAgent.cpp:
+        (WebCore::InspectorPageAgent::buildObjectForFrameTree):
+        * inspector/InspectorResourceAgent.cpp:
+        (WebCore::buildObjectForTiming):
+        (WebCore::buildObjectForCachedResource):
+        * inspector/InspectorStyleSheet.cpp:
+        (WebCore::InspectorStyle::buildObjectForStyle):
+        (WebCore::InspectorStyleSheet::create):
+        (WebCore::InspectorStyleSheet::InspectorStyleSheet):
+        (WebCore::InspectorStyleSheet::buildObjectForRule):
+        (WebCore::InspectorStyleSheet::resourceStyleSheetText):
+        (WebCore::InspectorStyleSheet::buildArrayForRuleList):
+        (WebCore::InspectorStyleSheetForInlineStyle::create):
+        (WebCore::InspectorStyleSheetForInlineStyle::InspectorStyleSheetForInlineStyle):
+        * inspector/InspectorStyleSheet.h:
+        (InspectorCSSId):
+        (WebCore::InspectorCSSId::asProtocolValue): method is made template as now it returns 2 formally different types.
+        (InspectorStyleSheet):
+        (WebCore::InspectorStyleSheet::canBind):
+        (InspectorStyleSheetForInlineStyle):
+
+2012-04-06  Pavel Feldman  <pfeldman@chromium.org>
+
+        Web Inspector: highlight diff in the gutter, not in the line content.
+        https://bugs.webkit.org/show_bug.cgi?id=83371
+
+        Reviewed by Yury Semikhatsky.
+
+        Now that the editing mode is enabled by default, diff highlighting gets annoying.
+        I am moving it to the gutter (same decoration as before, but now coloring gutter only).
+
+        * inspector/front-end/TextViewer.js:
+        (WebInspector.TextEditorGutterPanel.prototype.textChanged):
+        * inspector/front-end/textViewer.css:
+        (.diff-container .webkit-added-line.webkit-line-number):
+        (.diff-container .webkit-removed-line.webkit-line-number):
+        (.diff-container .webkit-changed-line.webkit-line-number):
+
 2012-04-06  Pavel Feldman  <pfeldman@chromium.org>
 
         Web Inspector: highlight diff in the gutter, not in the line content.
index 9faf5f4..437bfe1 100755 (executable)
@@ -1202,8 +1202,8 @@ class TypeBindings:
 
                                     param_type_binding = prop_data.param_type_binding
                                     param_raw_type = param_type_binding.reduce_to_raw_type()
-                                    for param_type_opt in MethodGenerateModes.get_modes(param_type_binding):
-                                        writer.newline_multiline("""
+
+                                    writer.newline_multiline("""
         Builder<STATE | %s>& set%s(%s value)
         {
             COMPILE_ASSERT(!(STATE & %s), property_%s_already_set);
@@ -1211,13 +1211,13 @@ class TypeBindings:
             return castState<%s>();
         }
 """
-                                        % (state_enum_items[pos],
-                                           Capitalizer.lower_camel_case_to_upper(prop_name),
-                                           param_type_opt.get_c_param_type_text(param_type_binding),
-                                           state_enum_items[pos], prop_name,
-                                           param_raw_type.get_setter_name(), prop_name,
-                                           param_type_opt.get_setter_value_expression(param_type_binding, "value"),
-                                           state_enum_items[pos]))
+                                    % (state_enum_items[pos],
+                                       Capitalizer.lower_camel_case_to_upper(prop_name),
+                                       param_type_binding.get_type_model().get_input_param_type_text(),
+                                       state_enum_items[pos], prop_name,
+                                       param_raw_type.get_setter_name(), prop_name,
+                                       format_setter_value_expression(param_type_binding, "value"),
+                                       state_enum_items[pos]))
 
                                     pos += 1
 
@@ -1258,14 +1258,13 @@ class TypeBindings:
                                     param_type_binding = prop_data.param_type_binding
                                     setter_name = "set%s" % Capitalizer.lower_camel_case_to_upper(prop_name)
 
-                                    for param_type_opt in MethodGenerateModes.get_modes(param_type_binding):
-                                        writer.append_multiline("\n    void %s" % setter_name)
-                                        writer.append("(%s value)\n" % param_type_opt.get_c_param_type_text(param_type_binding))
-                                        writer.newline("    {\n")
-                                        writer.newline("        this->set%s(\"%s\", %s);\n"
-                                            % (param_type_binding.reduce_to_raw_type().get_setter_name(), prop_data.p["name"],
-                                               param_type_opt.get_setter_value_expression(param_type_binding, "value")))
-                                        writer.newline("    }\n")
+                                    writer.append_multiline("\n    void %s" % setter_name)
+                                    writer.append("(%s value)\n" % param_type_binding.get_type_model().get_input_param_type_text())
+                                    writer.newline("    {\n")
+                                    writer.newline("        this->set%s(\"%s\", %s);\n"
+                                        % (param_type_binding.reduce_to_raw_type().get_setter_name(), prop_data.p["name"],
+                                           format_setter_value_expression(param_type_binding, "value")))
+                                    writer.newline("    }\n")
 
 
                                     if setter_name in INSPECTOR_OBJECT_SETTER_NAMES:
@@ -1430,7 +1429,7 @@ class TypeBindings:
 
                 class AdHocTypeContext:
                     container_full_name_prefix = "<not yet defined>"
-                    container_relative_name_prefix = "<not yet defined>"
+                    container_relative_name_prefix = ""
 
                     @staticmethod
                     def get_type_name_fix():
@@ -2438,57 +2437,12 @@ def get_annotated_type_text(raw_type, annotated_type):
         return raw_type
 
 
-# Chooses method generate modes for a particular type. A particular setter
-# can be generated as one method with a simple parameter type,
-# as one method with a raw type name and commented annotation about expected
-# specialized type name or as overloaded method when raw and specialized
-# parameter types require different behavior.
-class MethodGenerateModes:
-    @classmethod
-    def get_modes(cls, type_binding):
-        if type_binding.get_setter_value_expression_pattern():
-            # In raw and strict modes method code is actually different.
-            return [cls.StrictParameterMode, cls.RawParameterMode]
-        else:
-            # In raw and strict modes method code is the same.
-            # Only put strict parameter type in comments.
-            return [cls.CombinedMode]
-
-    class StrictParameterMode:
-        @staticmethod
-        def get_c_param_type_text(type_binding):
-            return type_binding.get_type_model().get_input_param_type_text()
-
-        @staticmethod
-        def get_setter_value_expression(param_type_binding, value_ref):
-            pattern = param_type_binding.get_setter_value_expression_pattern()
-            if pattern:
-                return pattern % value_ref
-            else:
-                return value_ref
-
-    class RawParameterMode:
-        @staticmethod
-        def get_c_param_type_text(type_binding):
-            return type_binding.reduce_to_raw_type().get_raw_type_model().get_input_param_type_text()
-
-        @staticmethod
-        def get_setter_value_expression(param_type_binding, value_ref):
-            return value_ref
-
-    class CombinedMode:
-        @staticmethod
-        def get_c_param_type_text(type_binding):
-            return get_annotated_type_text(type_binding.reduce_to_raw_type().get_raw_type_model().get_input_param_type_text(),
-                type_binding.get_type_model().get_input_param_type_text())
-
-        @staticmethod
-        def get_setter_value_expression(param_type_binding, value_ref):
-            pattern = param_type_binding.get_setter_value_expression_pattern()
-            if pattern:
-                return pattern % value_ref
-            else:
-                return value_ref
+def format_setter_value_expression(param_type_binding, value_ref):
+    pattern = param_type_binding.get_setter_value_expression_pattern()
+    if pattern:
+        return pattern % value_ref
+    else:
+        return value_ref
 
 class Generator:
     frontend_class_field_lines = []
index cf53b4d..acbdde7 100644 (file)
@@ -93,44 +93,44 @@ ConsoleMessage::~ConsoleMessage()
 }
 
 // Keep in sync with inspector/front-end/ConsoleView.js
-static String messageSourceValue(MessageSource source)
+static TypeBuilder::Console::ConsoleMessage::Source::Enum messageSourceValue(MessageSource source)
 {
     switch (source) {
-    case HTMLMessageSource: return "html";
-    case XMLMessageSource: return "xml";
-    case JSMessageSource: return "javascript";
-    case NetworkMessageSource: return "network";
-    case ConsoleAPIMessageSource: return "console-api";
-    case OtherMessageSource: return "other";
+    case HTMLMessageSource: return TypeBuilder::Console::ConsoleMessage::Source::Html;
+    case XMLMessageSource: return TypeBuilder::Console::ConsoleMessage::Source::Xml;
+    case JSMessageSource: return TypeBuilder::Console::ConsoleMessage::Source::Javascript;
+    case NetworkMessageSource: return TypeBuilder::Console::ConsoleMessage::Source::Network;
+    case ConsoleAPIMessageSource: return TypeBuilder::Console::ConsoleMessage::Source::Console_api;
+    case OtherMessageSource: return TypeBuilder::Console::ConsoleMessage::Source::Other;
     }
-    return "other";
+    return TypeBuilder::Console::ConsoleMessage::Source::Other;
 }
 
-static String messageTypeValue(MessageType type)
+static TypeBuilder::Console::ConsoleMessage::Type::Enum messageTypeValue(MessageType type)
 {
     switch (type) {
-    case LogMessageType: return "log";
-    case DirMessageType: return "dir";
-    case DirXMLMessageType: return "dirXML";
-    case TraceMessageType: return "trace";
-    case StartGroupMessageType: return "startGroup";
-    case StartGroupCollapsedMessageType: return "startGroupCollapsed";
-    case EndGroupMessageType: return "endGroup";
-    case AssertMessageType: return "assert";
+    case LogMessageType: return TypeBuilder::Console::ConsoleMessage::Type::Log;
+    case DirMessageType: return TypeBuilder::Console::ConsoleMessage::Type::Dir;
+    case DirXMLMessageType: return TypeBuilder::Console::ConsoleMessage::Type::Dirxml;
+    case TraceMessageType: return TypeBuilder::Console::ConsoleMessage::Type::Trace;
+    case StartGroupMessageType: return TypeBuilder::Console::ConsoleMessage::Type::StartGroup;
+    case StartGroupCollapsedMessageType: return TypeBuilder::Console::ConsoleMessage::Type::StartGroupCollapsed;
+    case EndGroupMessageType: return TypeBuilder::Console::ConsoleMessage::Type::EndGroup;
+    case AssertMessageType: return TypeBuilder::Console::ConsoleMessage::Type::Assert;
     }
-    return "log";
+    return TypeBuilder::Console::ConsoleMessage::Type::Log;
 }
 
-static String messageLevelValue(MessageLevel level)
+static TypeBuilder::Console::ConsoleMessage::Level::Enum messageLevelValue(MessageLevel level)
 {
     switch (level) {
-    case TipMessageLevel: return "tip";
-    case LogMessageLevel: return "log";
-    case WarningMessageLevel: return "warning";
-    case ErrorMessageLevel: return "error";
-    case DebugMessageLevel: return "debug";
+    case TipMessageLevel: return TypeBuilder::Console::ConsoleMessage::Level::Tip;
+    case LogMessageLevel: return TypeBuilder::Console::ConsoleMessage::Level::Log;
+    case WarningMessageLevel: return TypeBuilder::Console::ConsoleMessage::Level::Warning;
+    case ErrorMessageLevel: return TypeBuilder::Console::ConsoleMessage::Level::Error;
+    case DebugMessageLevel: return TypeBuilder::Console::ConsoleMessage::Level::Debug;
     }
-    return "log";
+    return TypeBuilder::Console::ConsoleMessage::Level::Log;
 }
 
 void ConsoleMessage::addToFrontend(InspectorFrontend::Console* frontend, InjectedScriptManager* injectedScriptManager)
@@ -149,14 +149,14 @@ void ConsoleMessage::addToFrontend(InspectorFrontend::Console* frontend, Injecte
     if (m_arguments && m_arguments->argumentCount()) {
         InjectedScript injectedScript = injectedScriptManager->injectedScriptFor(m_arguments->globalState());
         if (!injectedScript.hasNoValue()) {
-            RefPtr<InspectorArray> jsonArgs = InspectorArray::create();
+            RefPtr<TypeBuilder::Array<TypeBuilder::Runtime::RemoteObject> > jsonArgs = TypeBuilder::Array<TypeBuilder::Runtime::RemoteObject>::create();
             for (unsigned i = 0; i < m_arguments->argumentCount(); ++i) {
-                RefPtr<InspectorValue> inspectorValue = injectedScript.wrapObject(m_arguments->argumentAt(i), "console");
+                RefPtr<TypeBuilder::Runtime::RemoteObject> inspectorValue = injectedScript.wrapObject(m_arguments->argumentAt(i), "console");
                 if (!inspectorValue) {
                     ASSERT_NOT_REACHED();
                     return;
                 }
-                jsonArgs->pushValue(inspectorValue);
+                jsonArgs->addItem(inspectorValue);
             }
             jsonObj->setParameters(jsonArgs);
         }
index c45f813..5bde985 100644 (file)
@@ -171,24 +171,20 @@ PassRefPtr<TypeBuilder::ApplicationCache::ApplicationCache> InspectorApplication
         .setResources(buildArrayForApplicationCacheResources(applicationCacheResources));
 }
 
-PassRefPtr<InspectorArray> InspectorApplicationCacheAgent::buildArrayForApplicationCacheResources(const ApplicationCacheHost::ResourceInfoList& applicationCacheResources)
+PassRefPtr<TypeBuilder::Array<TypeBuilder::ApplicationCache::ApplicationCacheResource> > InspectorApplicationCacheAgent::buildArrayForApplicationCacheResources(const ApplicationCacheHost::ResourceInfoList& applicationCacheResources)
 {
-    RefPtr<InspectorArray> resources = InspectorArray::create();
+    RefPtr<TypeBuilder::Array<TypeBuilder::ApplicationCache::ApplicationCacheResource> > resources = TypeBuilder::Array<TypeBuilder::ApplicationCache::ApplicationCacheResource>::create();
 
     ApplicationCacheHost::ResourceInfoList::const_iterator end = applicationCacheResources.end();
     ApplicationCacheHost::ResourceInfoList::const_iterator it = applicationCacheResources.begin();
     for (int i = 0; it != end; ++it, i++)
-        resources->pushObject(buildObjectForApplicationCacheResource(*it));
+        resources->addItem(buildObjectForApplicationCacheResource(*it));
 
     return resources;
 }
 
-PassRefPtr<InspectorObject> InspectorApplicationCacheAgent::buildObjectForApplicationCacheResource(const ApplicationCacheHost::ResourceInfo& resourceInfo)
+PassRefPtr<TypeBuilder::ApplicationCache::ApplicationCacheResource> InspectorApplicationCacheAgent::buildObjectForApplicationCacheResource(const ApplicationCacheHost::ResourceInfo& resourceInfo)
 {
-    RefPtr<InspectorObject> value = InspectorObject::create();
-    value->setString("url", resourceInfo.m_resource.string());
-    value->setNumber("size", resourceInfo.m_size);
-
     String types;
     if (resourceInfo.m_isMaster)
         types.append("Master ");
@@ -205,7 +201,10 @@ PassRefPtr<InspectorObject> InspectorApplicationCacheAgent::buildObjectForApplic
     if (resourceInfo.m_isExplicit)
         types.append("Explicit ");
 
-    value->setString("type", types);
+    RefPtr<TypeBuilder::ApplicationCache::ApplicationCacheResource> value = TypeBuilder::ApplicationCache::ApplicationCacheResource::create()
+        .setUrl(resourceInfo.m_resource.string())
+        .setSize(resourceInfo.m_size)
+        .setType(types);
     return value;
 }
 
index 35bb872..2fef076 100644 (file)
@@ -76,8 +76,8 @@ public:
 private:
     InspectorApplicationCacheAgent(InstrumentingAgents*, InspectorState*, InspectorPageAgent*);
     PassRefPtr<TypeBuilder::ApplicationCache::ApplicationCache> buildObjectForApplicationCache(const ApplicationCacheHost::ResourceInfoList&, const ApplicationCacheHost::CacheInfo&);
-    PassRefPtr<InspectorArray> buildArrayForApplicationCacheResources(const ApplicationCacheHost::ResourceInfoList&);
-    PassRefPtr<InspectorObject> buildObjectForApplicationCacheResource(const ApplicationCacheHost::ResourceInfo&);
+    PassRefPtr<TypeBuilder::Array<TypeBuilder::ApplicationCache::ApplicationCacheResource> > buildArrayForApplicationCacheResources(const ApplicationCacheHost::ResourceInfoList&);
+    PassRefPtr<TypeBuilder::ApplicationCache::ApplicationCacheResource> buildObjectForApplicationCacheResource(const ApplicationCacheHost::ResourceInfo&);
 
     DocumentLoader* assertFrameWithDocumentLoader(ErrorString*, String frameId);
 
index 1610cd7..8114377 100644 (file)
@@ -826,7 +826,7 @@ InspectorStyleSheetForInlineStyle* InspectorCSSAgent::asInspectorStyleSheet(Elem
             return 0;
 
         String newStyleSheetId = String::number(m_lastStyleSheetId++);
-        RefPtr<InspectorStyleSheetForInlineStyle> inspectorStyleSheet = InspectorStyleSheetForInlineStyle::create(newStyleSheetId, element, "regular", this);
+        RefPtr<InspectorStyleSheetForInlineStyle> inspectorStyleSheet = InspectorStyleSheetForInlineStyle::create(newStyleSheetId, element, TypeBuilder::CSS::CSSRule::Origin::Regular, this);
         m_idToInspectorStyleSheet.set(newStyleSheetId, inspectorStyleSheet);
         m_nodeToInspectorStyleSheet.set(element, inspectorStyleSheet);
         return inspectorStyleSheet.get();
@@ -912,7 +912,7 @@ InspectorStyleSheet* InspectorCSSAgent::viaInspectorStyleSheet(Document* documen
         return 0;
     CSSStyleSheet* cssStyleSheet = static_cast<CSSStyleSheet*>(styleSheet);
     String id = String::number(m_lastStyleSheetId++);
-    inspectorStyleSheet = InspectorStyleSheet::create(id, cssStyleSheet, "inspector", InspectorDOMAgent::documentURLString(document), this);
+    inspectorStyleSheet = InspectorStyleSheet::create(id, cssStyleSheet, TypeBuilder::CSS::CSSRule::Origin::Inspector, InspectorDOMAgent::documentURLString(document), this);
     m_idToInspectorStyleSheet.set(id, inspectorStyleSheet);
     m_cssStyleSheetToInspectorStyleSheet.set(cssStyleSheet, inspectorStyleSheet);
     m_documentToInspectorStyleSheet.set(document, inspectorStyleSheet);
@@ -929,21 +929,17 @@ InspectorStyleSheet* InspectorCSSAgent::assertStyleSheetForId(ErrorString* error
     return it->second.get();
 }
 
-String InspectorCSSAgent::detectOrigin(CSSStyleSheet* pageStyleSheet, Document* ownerDocument)
+TypeBuilder::CSS::CSSRule::Origin::Enum InspectorCSSAgent::detectOrigin(CSSStyleSheet* pageStyleSheet, Document* ownerDocument)
 {
-    DEFINE_STATIC_LOCAL(String, userAgent, ("user-agent"));
-    DEFINE_STATIC_LOCAL(String, user, ("user"));
-    DEFINE_STATIC_LOCAL(String, inspector, ("inspector"));
-
-    String origin("regular");
+    TypeBuilder::CSS::CSSRule::Origin::Enum origin = TypeBuilder::CSS::CSSRule::Origin::Regular;
     if (pageStyleSheet && !pageStyleSheet->ownerNode() && pageStyleSheet->href().isEmpty())
-        origin = userAgent;
+        origin = TypeBuilder::CSS::CSSRule::Origin::User_agent;
     else if (pageStyleSheet && pageStyleSheet->ownerNode() && pageStyleSheet->ownerNode()->nodeName() == "#document")
-        origin = user;
+        origin = TypeBuilder::CSS::CSSRule::Origin::User;
     else {
         InspectorStyleSheet* viaInspectorStyleSheetForOwner = viaInspectorStyleSheet(ownerDocument, false);
         if (viaInspectorStyleSheetForOwner && pageStyleSheet == viaInspectorStyleSheetForOwner->pageStyleSheet())
-            origin = inspector;
+            origin = TypeBuilder::CSS::CSSRule::Origin::Inspector;
     }
     return origin;
 }
index 227b9a8..714b86d 100644 (file)
@@ -143,7 +143,7 @@ private:
     InspectorStyleSheet* bindStyleSheet(CSSStyleSheet*);
     InspectorStyleSheet* viaInspectorStyleSheet(Document*, bool createIfAbsent);
     InspectorStyleSheet* assertStyleSheetForId(ErrorString*, const String&);
-    String detectOrigin(CSSStyleSheet* pageStyleSheet, Document* ownerDocument);
+    TypeBuilder::CSS::CSSRule::Origin::Enum detectOrigin(CSSStyleSheet* pageStyleSheet, Document* ownerDocument);
 
     PassRefPtr<TypeBuilder::Array<TypeBuilder::CSS::CSSRule> > buildArrayForRuleList(CSSRuleList*, CSSStyleSelector*);
     PassRefPtr<TypeBuilder::CSS::CSSStyle> buildObjectForAttributesStyle(Element*);
index 8b9ad92..ce437bf 100644 (file)
@@ -1208,7 +1208,7 @@ PassRefPtr<TypeBuilder::DOM::Node> InspectorDOMAgent::buildObjectForNode(Node* n
     if (node->isContainerNode()) {
         int nodeCount = innerChildNodeCount(node);
         value->setChildNodeCount(nodeCount);
-        RefPtr<InspectorArray> children = buildArrayForContainerChildren(node, depth, nodesMap);
+        RefPtr<TypeBuilder::Array<TypeBuilder::DOM::Node> > children = buildArrayForContainerChildren(node, depth, nodesMap);
         if (children->length() > 0)
             value->setChildren(children.release());
     }
@@ -1223,9 +1223,9 @@ PassRefPtr<TypeBuilder::DOM::Node> InspectorDOMAgent::buildObjectForNode(Node* n
                 value->setContentDocument(buildObjectForNode(doc, 0, nodesMap));
         }
         if (element->hasShadowRoot()) {
-            RefPtr<InspectorArray> shadowRoots = InspectorArray::create();
+            RefPtr<TypeBuilder::Array<TypeBuilder::DOM::Node> > shadowRoots = TypeBuilder::Array<TypeBuilder::DOM::Node>::create();
             for (ShadowRoot* root = element->shadowTree()->youngestShadowRoot(); root; root = root->olderShadowRoot())
-                shadowRoots->pushObject(buildObjectForNode(root, 0, nodesMap));
+                shadowRoots->addItem(buildObjectForNode(root, 0, nodesMap));
             value->setShadowRoots(shadowRoots);
         }
     } else if (node->isDocumentNode()) {
index 647f9b7..86601bf 100644 (file)
@@ -142,9 +142,9 @@ public:
         if (!m_frontendProvider->frontend())
             return;
 
-        RefPtr<InspectorArray> databaseNames = InspectorArray::create();
+        RefPtr<TypeBuilder::Array<String> > databaseNames = TypeBuilder::Array<String>::create();
         for (size_t i = 0; i < databaseNamesList->length(); ++i)
-            databaseNames->pushString(databaseNamesList->item(i));
+            databaseNames->addItem(databaseNamesList->item(i));
 
         RefPtr<SecurityOriginWithDatabaseNames> result = SecurityOriginWithDatabaseNames::create()
             .setSecurityOrigin(m_securityOrigin)
@@ -239,7 +239,7 @@ public:
         if (!m_frontendProvider->frontend())
             return;
 
-        RefPtr<InspectorArray> objectStores = InspectorArray::create();
+        RefPtr<TypeBuilder::Array<TypeBuilder::IndexedDB::ObjectStore> > objectStores = TypeBuilder::Array<TypeBuilder::IndexedDB::ObjectStore>::create();
 
         RefPtr<DOMStringList> objectStoreNamesList = idbDatabase->objectStoreNames();
         for (size_t i = 0; i < objectStoreNamesList->length(); ++i) {
@@ -251,7 +251,7 @@ public:
             if (!idbObjectStore)
                 continue;
 
-            RefPtr<InspectorArray> indexes = InspectorArray::create();
+            RefPtr<TypeBuilder::Array<TypeBuilder::IndexedDB::ObjectStoreIndex> > indexes = TypeBuilder::Array<TypeBuilder::IndexedDB::ObjectStoreIndex>::create();
             RefPtr<DOMStringList> indexNamesList = idbObjectStore->indexNames();
             for (size_t j = 0; j < indexNamesList->length(); ++j) {
                 RefPtr<IDBIndexBackendInterface> idbIndex = indexForObjectStore(idbObjectStore.get(), indexNamesList->item(j));
@@ -263,14 +263,14 @@ public:
                     .setKeyPath(idbIndex->keyPath())
                     .setUnique(idbIndex->unique())
                     .setMultiEntry(idbIndex->multiEntry());
-                indexes->pushObject(objectStoreIndex);
+                indexes->addItem(objectStoreIndex);
             }
 
             RefPtr<ObjectStore> objectStore = ObjectStore::create()
                 .setName(idbObjectStore->name())
                 .setKeyPath(idbObjectStore->keyPath())
                 .setIndexes(indexes);
-            objectStores->pushObject(objectStore);
+            objectStores->addItem(objectStore);
         }
         RefPtr<DatabaseWithObjectStores> result = DatabaseWithObjectStores::create()
             .setName(idbDatabase->name())
@@ -390,10 +390,10 @@ static PassRefPtr<Key> keyFromIDBKey(IDBKey* idbKey)
     case IDBKey::ArrayType: {
         RefPtr<Key> tmpKey = Key::create().setType(Key::Type::Array);
         key = tmpKey;
-        RefPtr<InspectorArray> array = InspectorArray::create();
+        RefPtr<TypeBuilder::Array<TypeBuilder::IndexedDB::Key> > array = TypeBuilder::Array<TypeBuilder::IndexedDB::Key>::create();
         IDBKey::KeyArray keyArray = idbKey->array();
         for (size_t i = 0; i < keyArray.size(); ++i)
-            array->pushObject(keyFromIDBKey(keyArray[i].get()));
+            array->addItem(keyFromIDBKey(keyArray[i].get()));
         key->setArray(array);
         break;
     }
@@ -442,7 +442,7 @@ public:
         RefPtr<IDBKey> key = m_idbCursor->key();
         RefPtr<IDBKey> primaryKey = m_idbCursor->primaryKey();
         RefPtr<SerializedScriptValue> value = m_idbCursor->value();
-        RefPtr<InspectorObject> wrappedValue = m_injectedScript.wrapSerializedObject(value.get(), String());
+        RefPtr<TypeBuilder::Runtime::RemoteObject> wrappedValue = m_injectedScript.wrapSerializedObject(value.get(), String());
         RefPtr<DataEntry> dataEntry = DataEntry::create()
             .setKey(keyFromIDBKey(key.get()))
             .setPrimaryKey(keyFromIDBKey(primaryKey.get()))
index c9fe82d..0cad49a 100644 (file)
@@ -116,24 +116,24 @@ public:
 
     int totalNodeCount() { return m_totalNodeCount; }
 
-    PassRefPtr<InspectorArray> nodeCount()
+    PassRefPtr<TypeBuilder::Array<TypeBuilder::Memory::NodeCount> > nodeCount()
     {
-        RefPtr<InspectorArray> childrenStats = InspectorArray::create();
+        RefPtr<TypeBuilder::Array<TypeBuilder::Memory::NodeCount> > childrenStats = TypeBuilder::Array<TypeBuilder::Memory::NodeCount>::create();
         for (HashMap<String, int>::iterator it = m_nodeNameToCount.begin(); it != m_nodeNameToCount.end(); ++it) {
             RefPtr<NodeCount> nodeCount = NodeCount::create().setNodeName(it->first)
                                                              .setCount(it->second);
-            childrenStats->pushObject(nodeCount);
+            childrenStats->addItem(nodeCount);
         }
         return childrenStats.release();
     }
 
-    PassRefPtr<InspectorArray> listenerCount()
+    PassRefPtr<TypeBuilder::Array<TypeBuilder::Memory::ListenerCount> > listenerCount()
     {
-        RefPtr<InspectorArray> listenerStats = InspectorArray::create();
+        RefPtr<TypeBuilder::Array<TypeBuilder::Memory::ListenerCount> > listenerStats = TypeBuilder::Array<TypeBuilder::Memory::ListenerCount>::create();
         for (HashMap<AtomicString, int>::iterator it = m_eventTypeToCount.begin(); it != m_eventTypeToCount.end(); ++it) {
             RefPtr<ListenerCount> listenerCount = ListenerCount::create().setType(it->first)
                                                                          .setCount(it->second);
-            listenerStats->pushObject(listenerCount);
+            listenerStats->addItem(listenerCount);
         }
         return listenerStats.release();
     }
index 90d4f24..82c01b9 100644 (file)
@@ -877,7 +877,7 @@ PassRefPtr<TypeBuilder::Page::Frame> InspectorPageAgent::buildObjectForFrame(Fra
 
 PassRefPtr<TypeBuilder::Page::FrameResourceTree> InspectorPageAgent::buildObjectForFrameTree(Frame* frame)
 {
-    RefPtr<InspectorObject> frameObject = buildObjectForFrame(frame);
+    RefPtr<TypeBuilder::Page::Frame> frameObject = buildObjectForFrame(frame);
     RefPtr<TypeBuilder::Array<TypeBuilder::Page::FrameResourceTree::Resources> > subresources = TypeBuilder::Array<TypeBuilder::Page::FrameResourceTree::Resources>::create();
     RefPtr<TypeBuilder::Page::FrameResourceTree> result = TypeBuilder::Page::FrameResourceTree::create()
          .setFrame(frameObject)
index 3088540..1700211 100644 (file)
@@ -104,22 +104,21 @@ static PassRefPtr<InspectorObject> buildObjectForHeaders(const HTTPHeaderMap& he
     return headersObject;
 }
 
-static PassRefPtr<InspectorObject> buildObjectForTiming(const ResourceLoadTiming& timing, DocumentLoader* loader)
-{
-    RefPtr<InspectorObject> timingObject = InspectorObject::create();
-    timingObject->setNumber("requestTime", timing.convertResourceLoadTimeToDocumentTime(loader->timing(), 0));
-    timingObject->setNumber("proxyStart", timing.proxyStart);
-    timingObject->setNumber("proxyEnd", timing.proxyEnd);
-    timingObject->setNumber("dnsStart", timing.dnsStart);
-    timingObject->setNumber("dnsEnd", timing.dnsEnd);
-    timingObject->setNumber("connectStart", timing.connectStart);
-    timingObject->setNumber("connectEnd", timing.connectEnd);
-    timingObject->setNumber("sslStart", timing.sslStart);
-    timingObject->setNumber("sslEnd", timing.sslEnd);
-    timingObject->setNumber("sendStart", timing.sendStart);
-    timingObject->setNumber("sendEnd", timing.sendEnd);
-    timingObject->setNumber("receiveHeadersEnd", timing.receiveHeadersEnd);
-    return timingObject;
+static PassRefPtr<TypeBuilder::Network::ResourceTiming> buildObjectForTiming(const ResourceLoadTiming& timing, DocumentLoader* loader)
+{
+    return TypeBuilder::Network::ResourceTiming::create()
+        .setRequestTime(timing.convertResourceLoadTimeToDocumentTime(loader->timing(), 0))
+        .setProxyStart(timing.proxyStart)
+        .setProxyEnd(timing.proxyEnd)
+        .setDnsStart(timing.dnsStart)
+        .setDnsEnd(timing.dnsEnd)
+        .setConnectStart(timing.connectStart)
+        .setConnectEnd(timing.connectEnd)
+        .setSslStart(timing.sslStart)
+        .setSslEnd(timing.sslEnd)
+        .setSendStart(timing.sendStart)
+        .setSendEnd(timing.sendEnd)
+        .setReceiveHeadersEnd(timing.receiveHeadersEnd);
 }
 
 static PassRefPtr<TypeBuilder::Network::Request> buildObjectForResourceRequest(const ResourceRequest& request)
@@ -185,7 +184,7 @@ static PassRefPtr<TypeBuilder::Network::CachedResource> buildObjectForCachedReso
         .setUrl(cachedResource.url())
         .setType(InspectorPageAgent::cachedResourceTypeJson(cachedResource))
         .setBodySize(cachedResource.encodedSize());
-    RefPtr<InspectorObject> resourceResponse = buildObjectForResourceResponse(cachedResource.response(), loader);
+    RefPtr<TypeBuilder::Network::Response> resourceResponse = buildObjectForResourceResponse(cachedResource.response(), loader);
     if (resourceResponse)
         resourceObject->setResponse(resourceResponse);
     return resourceObject;
index 1c3080b..ec5b77e 100644 (file)
@@ -262,7 +262,7 @@ PassRefPtr<TypeBuilder::CSS::CSSStyle> InspectorStyle::buildObjectForStyle() con
 {
     RefPtr<TypeBuilder::CSS::CSSStyle> result = styleWithProperties();
     if (!m_styleId.isEmpty())
-        result->setStyleId(m_styleId.asProtocolValue());
+        result->setStyleId(m_styleId.asProtocolValue<TypeBuilder::CSS::CSSStyleId>());
 
     result->setWidth(m_style->getPropertyValue("width"));
     result->setHeight(m_style->getPropertyValue("height"));
@@ -681,7 +681,7 @@ NewLineAndWhitespace& InspectorStyle::newLineAndWhitespaceDelimiters() const
     return m_format;
 }
 
-PassRefPtr<InspectorStyleSheet> InspectorStyleSheet::create(const String& id, PassRefPtr<CSSStyleSheet> pageStyleSheet, const String& origin, const String& documentURL, Listener* listener)
+PassRefPtr<InspectorStyleSheet> InspectorStyleSheet::create(const String& id, PassRefPtr<CSSStyleSheet> pageStyleSheet, TypeBuilder::CSS::CSSRule::Origin::Enum origin, const String& documentURL, Listener* listener)
 {
     return adoptRef(new InspectorStyleSheet(id, pageStyleSheet, origin, documentURL, listener));
 }
@@ -694,7 +694,7 @@ String InspectorStyleSheet::styleSheetURL(CSSStyleSheet* pageStyleSheet)
     return emptyString();
 }
 
-InspectorStyleSheet::InspectorStyleSheet(const String& id, PassRefPtr<CSSStyleSheet> pageStyleSheet, const String& origin, const String& documentURL, Listener* listener)
+InspectorStyleSheet::InspectorStyleSheet(const String& id, PassRefPtr<CSSStyleSheet> pageStyleSheet, TypeBuilder::CSS::CSSRule::Origin::Enum origin, const String& documentURL, Listener* listener)
     : m_id(id)
     , m_pageStyleSheet(pageStyleSheet)
     , m_origin(origin)
@@ -890,13 +890,13 @@ PassRefPtr<TypeBuilder::CSS::CSSRule> InspectorStyleSheet::buildObjectForRule(CS
         .setStyle(buildObjectForStyle(rule->style()));
 
     // "sourceURL" is present only for regular rules, otherwise "origin" should be used in the frontend.
-    if (m_origin == "regular")
+    if (m_origin == TypeBuilder::CSS::CSSRule::Origin::Regular)
         result->setSourceURL(finalURL());
 
     if (canBind()) {
         InspectorCSSId id(ruleId(rule));
         if (!id.isEmpty())
-            result->setRuleId(id.asProtocolValue());
+            result->setRuleId(id.asProtocolValue<TypeBuilder::CSS::CSSRuleId>());
     }
 
     RefPtr<CSSRuleSourceData> sourceData;
@@ -1196,7 +1196,7 @@ bool InspectorStyleSheet::originalStyleSheetText(String* result) const
 
 bool InspectorStyleSheet::resourceStyleSheetText(String* result) const
 {
-    if (m_origin == "user" || m_origin == "user-agent")
+    if (m_origin == TypeBuilder::CSS::CSSRule::Origin::User || m_origin == TypeBuilder::CSS::CSSRule::Origin::User_agent)
         return false;
 
     if (!m_pageStyleSheet || !ownerDocument() || !ownerDocument()->frame())
@@ -1228,9 +1228,9 @@ bool InspectorStyleSheet::inlineStyleSheetText(String* result) const
     return true;
 }
 
-PassRefPtr<InspectorArray> InspectorStyleSheet::buildArrayForRuleList(CSSRuleList* ruleList)
+PassRefPtr<TypeBuilder::Array<TypeBuilder::CSS::CSSRule> > InspectorStyleSheet::buildArrayForRuleList(CSSRuleList* ruleList)
 {
-    RefPtr<InspectorArray> result = InspectorArray::create();
+    RefPtr<TypeBuilder::Array<TypeBuilder::CSS::CSSRule> > result = TypeBuilder::Array<TypeBuilder::CSS::CSSRule>::create();
     if (!ruleList)
         return result.release();
 
@@ -1239,7 +1239,7 @@ PassRefPtr<InspectorArray> InspectorStyleSheet::buildArrayForRuleList(CSSRuleLis
     collectFlatRules(refRuleList, &rules);
 
     for (unsigned i = 0, size = rules.size(); i < size; ++i)
-        result->pushObject(buildObjectForRule(rules.at(i)));
+        result->addItem(buildObjectForRule(rules.at(i)));
 
     return result.release();
 }
@@ -1307,12 +1307,12 @@ void InspectorStyleSheet::collectFlatRules(PassRefPtr<CSSRuleList> ruleList, Vec
     }
 }
 
-PassRefPtr<InspectorStyleSheetForInlineStyle> InspectorStyleSheetForInlineStyle::create(const String& id, PassRefPtr<Element> element, const String& origin, Listener* listener)
+PassRefPtr<InspectorStyleSheetForInlineStyle> InspectorStyleSheetForInlineStyle::create(const String& id, PassRefPtr<Element> element, TypeBuilder::CSS::CSSRule::Origin::Enum origin, Listener* listener)
 {
     return adoptRef(new InspectorStyleSheetForInlineStyle(id, element, origin, listener));
 }
 
-InspectorStyleSheetForInlineStyle::InspectorStyleSheetForInlineStyle(const String& id, PassRefPtr<Element> element, const String& origin, Listener* listener)
+InspectorStyleSheetForInlineStyle::InspectorStyleSheetForInlineStyle(const String& id, PassRefPtr<Element> element, TypeBuilder::CSS::CSSRule::Origin::Enum origin, Listener* listener)
     : InspectorStyleSheet(id, 0, origin, "", listener)
     , m_element(element)
     , m_ruleSourceData(0)
index 8d80f29..03a52d0 100644 (file)
@@ -81,12 +81,14 @@ public:
     const String& styleSheetId() const { return m_styleSheetId; }
     unsigned ordinal() const { return m_ordinal; }
 
-    PassRefPtr<TypeBuilder::CSS::CSSStyleId> asProtocolValue() const
+    // ID type is either TypeBuilder::CSS::CSSStyleId or TypeBuilder::CSS::CSSRuleId.
+    template<typename ID>
+    PassRefPtr<ID> asProtocolValue() const
     {
         if (isEmpty())
             return 0;
 
-        RefPtr<TypeBuilder::CSS::CSSStyleId> result = TypeBuilder::CSS::CSSStyleId::create()
+        RefPtr<ID> result = ID::create()
             .setStyleSheetId(m_styleSheetId)
             .setOrdinal(m_ordinal);
         return result.release();
@@ -168,7 +170,7 @@ public:
     };
 
     typedef HashMap<CSSStyleDeclaration*, RefPtr<InspectorStyle> > InspectorStyleMap;
-    static PassRefPtr<InspectorStyleSheet> create(const String& id, PassRefPtr<CSSStyleSheet> pageStyleSheet, const String& origin, const String& documentURL, Listener*);
+    static PassRefPtr<InspectorStyleSheet> create(const String& id, PassRefPtr<CSSStyleSheet> pageStyleSheet, TypeBuilder::CSS::CSSRule::Origin::Enum, const String& documentURL, Listener*);
     static String styleSheetURL(CSSStyleSheet* pageStyleSheet);
 
     virtual ~InspectorStyleSheet();
@@ -198,9 +200,9 @@ public:
     InspectorCSSId styleId(CSSStyleDeclaration* style) const { return ruleOrStyleId(style); }
 
 protected:
-    InspectorStyleSheet(const String& id, PassRefPtr<CSSStyleSheet> pageStyleSheet, const String& origin, const String& documentURL, Listener*);
+    InspectorStyleSheet(const String& id, PassRefPtr<CSSStyleSheet> pageStyleSheet, TypeBuilder::CSS::CSSRule::Origin::Enum, const String& documentURL, Listener*);
 
-    bool canBind() const { return m_origin != "userAgent" && m_origin != "user"; }
+    bool canBind() const { return m_origin != TypeBuilder::CSS::CSSRule::Origin::User_agent && m_origin != TypeBuilder::CSS::CSSRule::Origin::User; }
     InspectorCSSId ruleOrStyleId(CSSStyleDeclaration* style) const;
     virtual Document* ownerDocument() const;
     virtual RefPtr<CSSRuleSourceData> ruleSourceDataFor(CSSStyleDeclaration* style) const;
@@ -226,11 +228,11 @@ private:
     bool originalStyleSheetText(String* result) const;
     bool resourceStyleSheetText(String* result) const;
     bool inlineStyleSheetText(String* result) const;
-    PassRefPtr<InspectorArray> buildArrayForRuleList(CSSRuleList*);
+    PassRefPtr<TypeBuilder::Array<TypeBuilder::CSS::CSSRule> > buildArrayForRuleList(CSSRuleList*);
 
     String m_id;
     RefPtr<CSSStyleSheet> m_pageStyleSheet;
-    String m_origin;
+    TypeBuilder::CSS::CSSRule::Origin::Enum m_origin;
     String m_documentURL;
     bool m_isRevalidating;
     ParsedStyleSheet* m_parsedStyleSheet;
@@ -241,14 +243,14 @@ private:
 
 class InspectorStyleSheetForInlineStyle : public InspectorStyleSheet {
 public:
-    static PassRefPtr<InspectorStyleSheetForInlineStyle> create(const String& id, PassRefPtr<Element>, const String& origin, Listener*);
+    static PassRefPtr<InspectorStyleSheetForInlineStyle> create(const String& id, PassRefPtr<Element>, TypeBuilder::CSS::CSSRule::Origin::Enum, Listener*);
 
     void didModifyElementAttribute();
     virtual bool getText(String* result) const;
     virtual CSSStyleDeclaration* styleForId(const InspectorCSSId& id) const { ASSERT_UNUSED(id, !id.ordinal()); return inlineStyle(); }
 
 protected:
-    InspectorStyleSheetForInlineStyle(const String& id, PassRefPtr<Element>, const String& origin, Listener*);
+    InspectorStyleSheetForInlineStyle(const String& id, PassRefPtr<Element>, TypeBuilder::CSS::CSSRule::Origin::Enum, Listener*);
 
     virtual Document* ownerDocument() const;
     virtual RefPtr<CSSRuleSourceData> ruleSourceDataFor(CSSStyleDeclaration* style) const { ASSERT_UNUSED(style, style == inlineStyle()); return m_ruleSourceData; }