Web Inspector: CodeGeneratorInspector.py: switch FileSystem, Profiler and Worker domains to typed API
https://bugs.webkit.org/show_bug.cgi?id=83069

Patch by Peter Rybin <peter.rybin@gmail.com> on 2012-04-05
Reviewed by Yury Semikhatsky.

Domains are switched to 'strict' mode. However, hardly any changes were needed in C++ code because
only basic types are currently used in Inspector.json.

* inspector/CodeGeneratorInspector.py:
* inspector/InspectorProfilerAgent.cpp:
(WebCore::InspectorProfilerAgent::getProfileHeaders):
(WebCore):
(WebCore::InspectorProfilerAgent::getObjectByHeapObjectId):
* inspector/InspectorProfilerAgent.h:
(InspectorProfilerAgent):

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@113318 268f45cc-cd09-0410-ab3c-d52691b4dbfc
diff --git a/Source/WebCore/inspector/CodeGeneratorInspector.py b/Source/WebCore/inspector/CodeGeneratorInspector.py
index 72adda1..9faf5f4 100755
--- a/Source/WebCore/inspector/CodeGeneratorInspector.py
+++ b/Source/WebCore/inspector/CodeGeneratorInspector.py
@@ -62,7 +62,8 @@
 STRICT_ENABLED_DOMAINS = ["Console", "DOMDebugger",
                           "CSS", "Debugger", "DOM", "Network", "Page", "Runtime",
                           "Inspector", "Memory", "Database",
-                          "IndexedDB", "DOMStorage", "ApplicationCache"]
+                          "IndexedDB", "DOMStorage", "ApplicationCache",
+                          "FileSystem", "Profiler", "Worker"]
 
 
 cmdline_parser = optparse.OptionParser()
@@ -2289,6 +2290,16 @@
     };
 };
 
+template<>
+struct ArrayItemHelper<InspectorObject> {
+    struct Traits {
+        static void pushRefPtr(InspectorArray* array, PassRefPtr<InspectorObject> value)
+        {
+            array->pushObject(value);
+        }
+    };
+};
+
 template<typename T>
 struct ArrayItemHelper<TypeBuilder::Array<T> > {
     struct Traits {
diff --git a/Source/WebCore/inspector/InspectorProfilerAgent.cpp b/Source/WebCore/inspector/InspectorProfilerAgent.cpp
index c76aae8..4b6a4c6 100644
--- a/Source/WebCore/inspector/InspectorProfilerAgent.cpp
+++ b/Source/WebCore/inspector/InspectorProfilerAgent.cpp
@@ -240,14 +240,16 @@
     return makeString(UserInitiatedProfileName, '.', String::number(m_currentUserInitiatedProfileNumber));
 }
 
-void InspectorProfilerAgent::getProfileHeaders(ErrorString*, RefPtr<InspectorArray>& headers)
+void InspectorProfilerAgent::getProfileHeaders(ErrorString*, RefPtr<TypeBuilder::Array<InspectorObject> >& headers)
 {
+    headers = TypeBuilder::Array<InspectorObject>::create();
+
     ProfilesMap::iterator profilesEnd = m_profiles.end();
     for (ProfilesMap::iterator it = m_profiles.begin(); it != profilesEnd; ++it)
-        headers->pushObject(createProfileHeader(*it->second));
+        headers->addItem(createProfileHeader(*it->second));
     HeapSnapshotsMap::iterator snapshotsEnd = m_snapshots.end();
     for (HeapSnapshotsMap::iterator it = m_snapshots.begin(); it != snapshotsEnd; ++it)
-        headers->pushObject(createSnapshotHeader(*it->second));
+        headers->addItem(createSnapshotHeader(*it->second));
 }
 
 namespace {
@@ -426,7 +428,7 @@
         m_frontend->setRecordingProfile(isProfiling);
 }
 
-void InspectorProfilerAgent::getObjectByHeapObjectId(ErrorString* error, int id, const String* objectGroup, RefPtr<InspectorObject>& result)
+void InspectorProfilerAgent::getObjectByHeapObjectId(ErrorString* error, int id, const String* objectGroup, RefPtr<TypeBuilder::Runtime::RemoteObject>& result)
 {
     ScriptObject heapObject = ScriptProfiler::objectByHeapObjectId(id);
     if (heapObject.hasNoValue()) {
diff --git a/Source/WebCore/inspector/InspectorProfilerAgent.h b/Source/WebCore/inspector/InspectorProfilerAgent.h
index e0b05a8..bd7f347 100644
--- a/Source/WebCore/inspector/InspectorProfilerAgent.h
+++ b/Source/WebCore/inspector/InspectorProfilerAgent.h
@@ -85,7 +85,7 @@
     void enable(bool skipRecompile);
     bool enabled() { return m_enabled; }
     String getCurrentUserInitiatedProfileName(bool incrementProfileNumber = false);
-    virtual void getProfileHeaders(ErrorString*, RefPtr<InspectorArray>& headers);
+    virtual void getProfileHeaders(ErrorString*, RefPtr<TypeBuilder::Array<InspectorObject> >& headers);
     virtual void getProfile(ErrorString*, const String& type, int uid, RefPtr<InspectorObject>& profileObject);
     virtual void removeProfile(ErrorString*, const String& type, int uid);
 
@@ -96,7 +96,7 @@
     virtual void takeHeapSnapshot(ErrorString*);
     void toggleRecordButton(bool isProfiling);
 
-    virtual void getObjectByHeapObjectId(ErrorString*, int id, const String* objectGroup, RefPtr<InspectorObject>& result);
+    virtual void getObjectByHeapObjectId(ErrorString*, int id, const String* objectGroup, RefPtr<TypeBuilder::Runtime::RemoteObject>& result);
 
 protected:
     InspectorProfilerAgent(InstrumentingAgents*, InspectorConsoleAgent*, InspectorState*, InjectedScriptManager*);