diff options
author | Ben Murdoch <benm@google.com> | 2010-08-13 05:20:16 -0700 |
---|---|---|
committer | Android (Google) Code Review <android-gerrit@google.com> | 2010-08-13 05:20:16 -0700 |
commit | f4958a7d95cd5fbc1c74905e229b02c95cd5ee78 (patch) | |
tree | 14a0f1b07a19948c2ed93d0d8547caa7fe10aa0e /WebCore/inspector/InspectorApplicationCacheAgent.cpp | |
parent | d074a7997da8ce379434eb6e208b97cde8a0841c (diff) | |
parent | f964bc1fd59a545a80a0cc2529ad8830be514871 (diff) | |
download | external_webkit-f4958a7d95cd5fbc1c74905e229b02c95cd5ee78.zip external_webkit-f4958a7d95cd5fbc1c74905e229b02c95cd5ee78.tar.gz external_webkit-f4958a7d95cd5fbc1c74905e229b02c95cd5ee78.tar.bz2 |
Merge changes I60a96064,I6929172f,Idefd9bec,I8cf448f2,I8791737a,I992c56b0,Ibb4b089d,I779a8ec0,Ife412e30,I2da1ae98,Ibcf41849
* changes:
Merge WebKit at r65072 : Update WebKit revision number.
Merge WebKit at r65072 : Update test_expectations.
Merge WebKit at r65072 : Complete cherry-pick of WebKit change 43848 to add EmptyDeviceMotionClient
Merge WebKit at r65072 : Implement DeviceMotionClientAndroid
Merge WebKit at r65072: JSC build fix in InspectorController.h
Merge WebKit at r65072: Fix V8 code generator.
Merge WebKit at r65072 : Build fix for JSC, update ambiguous usage of JSLock.
Merge WebKit at r65072: String class has moved to the WTF namespace.
Merge Webkit at r65072 : Fix conflicts.
Merge Webkit at r65072 : Fix Makefiles.
Merge WebKit at r65072 : Initial merge by git.
Diffstat (limited to 'WebCore/inspector/InspectorApplicationCacheAgent.cpp')
-rw-r--r-- | WebCore/inspector/InspectorApplicationCacheAgent.cpp | 59 |
1 files changed, 27 insertions, 32 deletions
diff --git a/WebCore/inspector/InspectorApplicationCacheAgent.cpp b/WebCore/inspector/InspectorApplicationCacheAgent.cpp index 1ea7556..b95c0e1 100644 --- a/WebCore/inspector/InspectorApplicationCacheAgent.cpp +++ b/WebCore/inspector/InspectorApplicationCacheAgent.cpp @@ -33,15 +33,14 @@ #include "Frame.h" #include "FrameLoader.h" #include "InspectorController.h" -#include "InspectorFrontend.h" +#include "InspectorValues.h" #include "Page.h" +#include "RemoteInspectorFrontend.h" #include "ResourceResponse.h" -#include "ScriptArray.h" -#include "ScriptObject.h" namespace WebCore { -InspectorApplicationCacheAgent::InspectorApplicationCacheAgent(InspectorController* inspectorController, InspectorFrontend* frontend) +InspectorApplicationCacheAgent::InspectorApplicationCacheAgent(InspectorController* inspectorController, RemoteInspectorFrontend* frontend) : m_inspectorController(inspectorController) , m_frontend(frontend) { @@ -62,52 +61,48 @@ void InspectorApplicationCacheAgent::updateNetworkState(bool isNowOnline) m_frontend->updateNetworkState(isNowOnline); } -void InspectorApplicationCacheAgent::getApplicationCaches(long callId) +void InspectorApplicationCacheAgent::getApplicationCaches(RefPtr<InspectorValue>* applicationCaches) { DocumentLoader* documentLoader = m_inspectorController->inspectedPage()->mainFrame()->loader()->documentLoader(); - if (!documentLoader) { - m_frontend->didGetApplicationCaches(callId, ScriptValue::undefined()); - return; - } - - ApplicationCacheHost* host = documentLoader->applicationCacheHost(); - ApplicationCacheHost::CacheInfo info = host->applicationCacheInfo(); - - ApplicationCacheHost::ResourceInfoList resources; - host->fillResourceList(&resources); + if (documentLoader) { + ApplicationCacheHost* host = documentLoader->applicationCacheHost(); + ApplicationCacheHost::CacheInfo info = host->applicationCacheInfo(); - m_frontend->didGetApplicationCaches(callId, buildObjectForApplicationCache(resources, info)); + ApplicationCacheHost::ResourceInfoList resources; + host->fillResourceList(&resources); + *applicationCaches = buildObjectForApplicationCache(resources, info); + } } -ScriptObject InspectorApplicationCacheAgent::buildObjectForApplicationCache(const ApplicationCacheHost::ResourceInfoList& applicationCacheResources, const ApplicationCacheHost::CacheInfo& applicationCacheInfo) +PassRefPtr<InspectorObject> InspectorApplicationCacheAgent::buildObjectForApplicationCache(const ApplicationCacheHost::ResourceInfoList& applicationCacheResources, const ApplicationCacheHost::CacheInfo& applicationCacheInfo) { - ScriptObject value = m_frontend->newScriptObject(); - value.set("size", applicationCacheInfo.m_size); - value.set("manifest", applicationCacheInfo.m_manifest.string()); - value.set("lastPathComponent", applicationCacheInfo.m_manifest.lastPathComponent()); - value.set("creationTime", applicationCacheInfo.m_creationTime); - value.set("updateTime", applicationCacheInfo.m_updateTime); - value.set("resources", buildArrayForApplicationCacheResources(applicationCacheResources)); + RefPtr<InspectorObject> value = InspectorObject::create(); + value->setNumber("size", applicationCacheInfo.m_size); + value->setString("manifest", applicationCacheInfo.m_manifest.string()); + value->setString("lastPathComponent", applicationCacheInfo.m_manifest.lastPathComponent()); + value->setNumber("creationTime", applicationCacheInfo.m_creationTime); + value->setNumber("updateTime", applicationCacheInfo.m_updateTime); + value->set("resources", buildArrayForApplicationCacheResources(applicationCacheResources)); return value; } -ScriptArray InspectorApplicationCacheAgent::buildArrayForApplicationCacheResources(const ApplicationCacheHost::ResourceInfoList& applicationCacheResources) +PassRefPtr<InspectorArray> InspectorApplicationCacheAgent::buildArrayForApplicationCacheResources(const ApplicationCacheHost::ResourceInfoList& applicationCacheResources) { - ScriptArray resources = m_frontend->newScriptArray(); + RefPtr<InspectorArray> resources = InspectorArray::create(); ApplicationCacheHost::ResourceInfoList::const_iterator end = applicationCacheResources.end(); ApplicationCacheHost::ResourceInfoList::const_iterator it = applicationCacheResources.begin(); for (int i = 0; it != end; ++it, i++) - resources.set(i, buildObjectForApplicationCacheResource(*it)); + resources->push(buildObjectForApplicationCacheResource(*it)); return resources; } -ScriptObject InspectorApplicationCacheAgent::buildObjectForApplicationCacheResource(const ApplicationCacheHost::ResourceInfo& resourceInfo) +PassRefPtr<InspectorObject> InspectorApplicationCacheAgent::buildObjectForApplicationCacheResource(const ApplicationCacheHost::ResourceInfo& resourceInfo) { - ScriptObject value = m_frontend->newScriptObject(); - value.set("name", resourceInfo.m_resource.string()); - value.set("size", resourceInfo.m_size); + RefPtr<InspectorObject> value = InspectorObject::create(); + value->setString("name", resourceInfo.m_resource.string()); + value->setNumber("size", resourceInfo.m_size); String types; if (resourceInfo.m_isMaster) @@ -125,7 +120,7 @@ ScriptObject InspectorApplicationCacheAgent::buildObjectForApplicationCacheResou if (resourceInfo.m_isExplicit) types.append("Explicit "); - value.set("type", types); + value->setString("type", types); return value; } |