Diff
Modified: trunk/LayoutTests/ChangeLog (120905 => 120906)
--- trunk/LayoutTests/ChangeLog 2012-06-21 06:08:47 UTC (rev 120905)
+++ trunk/LayoutTests/ChangeLog 2012-06-21 07:23:48 UTC (rev 120906)
@@ -1,3 +1,17 @@
+2012-06-21 Taiju Tsuiki <[email protected]>
+
+ Web Inspector: Move requestId allocation from FileSystem frontend to backend
+ https://bugs.webkit.org/show_bug.cgi?id=89555
+
+ Reviewed by Vsevolod Vlasov.
+
+ * http/tests/inspector/filesystem/filesystem-test.js:
+ (initialize_FileSystemTest.InspectorTest.dumpReadDirectoryResult):
+ (initialize_FileSystemTest):
+ * http/tests/inspector/filesystem/get-filesystem-root.html:
+ * http/tests/inspector/filesystem/read-directory-expected.txt:
+ * http/tests/inspector/filesystem/read-directory.html:
+
2012-06-20 Hayato Ito <[email protected]>
[Shadow][Editing] Deleting character in distributed element caused a crash
Modified: trunk/LayoutTests/http/tests/inspector/filesystem/filesystem-test.js (120905 => 120906)
--- trunk/LayoutTests/http/tests/inspector/filesystem/filesystem-test.js 2012-06-21 06:08:47 UTC (rev 120905)
+++ trunk/LayoutTests/http/tests/inspector/filesystem/filesystem-test.js 2012-06-21 07:23:48 UTC (rev 120906)
@@ -34,9 +34,8 @@
InspectorTest.evaluateInPage("clearFileSystem(" + InspectorTest.registerCallback(callback) + ")");
};
- InspectorTest.dumpReadDirectoryResult = function(requestId, errorCode, entries)
+ InspectorTest.dumpReadDirectoryResult = function(errorCode, entries)
{
- InspectorTest.addResult("requestId: " + requestId);
InspectorTest.addResult("errorCode: " + errorCode);
if (!entries) {
Modified: trunk/LayoutTests/http/tests/inspector/filesystem/get-filesystem-root.html (120905 => 120906)
--- trunk/LayoutTests/http/tests/inspector/filesystem/get-filesystem-root.html 2012-06-21 06:08:47 UTC (rev 120905)
+++ trunk/LayoutTests/http/tests/inspector/filesystem/get-filesystem-root.html 2012-06-21 07:23:48 UTC (rev 120906)
@@ -5,7 +5,7 @@
document.addEventListener("DOMContentLoaded", runTest);
function test()
{
- var fileSystemRequestManager = new WebInspector.FileSystemRequestManager();
+ var requestManager = new WebInspector.FileSystemRequestManager();
InspectorTest.clearFileSystem(step1);
@@ -18,7 +18,7 @@
function step2()
{
- fileSystemRequestManager.getFileSystemRoot("http://127.0.0.1:8000", "temporary", step3);
+ requestManager.requestFileSystemRoot("http://127.0.0.1:8000", "temporary", step3);
}
function step3(errorCode, backendRootEntry)
Modified: trunk/LayoutTests/http/tests/inspector/filesystem/read-directory-expected.txt (120905 => 120906)
--- trunk/LayoutTests/http/tests/inspector/filesystem/read-directory-expected.txt 2012-06-21 06:08:47 UTC (rev 120905)
+++ trunk/LayoutTests/http/tests/inspector/filesystem/read-directory-expected.txt 2012-06-21 07:23:48 UTC (rev 120906)
@@ -1,6 +1,5 @@
Tests readDirectory.
-requestId: 1
errorCode: 0
entries:
0:
@@ -13,7 +12,6 @@
url: filesystem:http://127.0.0.1:8000/temporary/hoge/fuga
name: fuga
isDirectory: true
-requestId: 1
errorCode: 1
entries: (null)
Modified: trunk/LayoutTests/http/tests/inspector/filesystem/read-directory.html (120905 => 120906)
--- trunk/LayoutTests/http/tests/inspector/filesystem/read-directory.html 2012-06-21 06:08:47 UTC (rev 120905)
+++ trunk/LayoutTests/http/tests/inspector/filesystem/read-directory.html 2012-06-21 07:23:48 UTC (rev 120906)
@@ -5,17 +5,8 @@
document.addEventListener("DOMContentLoaded", runTest);
function test()
{
- // FIXME: Replace FileSystemDispatcher with FileSystemDispatcher implementation after it landed.
- function FileSystemDispatcher() {}
- FileSystemDispatcher.prototype = {
- didReadDirectory: function(requestId, errorCode, entries)
- {
- }
- };
+ var requestManager = new WebInspector.FileSystemRequestManager();
- InspectorBackend.registerFileSystemDispatcher(new FileSystemDispatcher());
- FileSystemAgent.enable();
-
InspectorTest.clearFileSystem(step1);
function step1()
@@ -35,22 +26,17 @@
function step4()
{
- InspectorTest.addSniffer(FileSystemDispatcher.prototype, "didReadDirectory", step5, false);
- // FIXME: Call FileSystemDispatcher through FileSystemDispatcher implementation after it landed.
- FileSystemAgent.readDirectory(1, "filesystem:http://127.0.0.1:8000/temporary/hoge");
+ requestManager.requestDirectoryContent("filesystem:http://127.0.0.1:8000/temporary/hoge", step5);
}
- function step5(requestId, errorCode, entries)
+ function step5(errorCode, entries)
{
- InspectorTest.dumpReadDirectoryResult(requestId, errorCode, entries);
-
- InspectorTest.addSniffer(FileSystemDispatcher.prototype, "didReadDirectory", step6, false);
- // FIXME: Call FileSystemDispatcher through FileSystemDispatcher implementation after it landed.
- FileSystemAgent.readDirectory(1, "filesystem:http://127.0.0.1:8000/temporary/foo");
+ InspectorTest.dumpReadDirectoryResult(errorCode, entries);
+ requestManager.requestDirectoryContent("filesystem:http://127.0.0.1:8000/temporary/foo", step6);
}
- function step6(requestId, errorCode, entries) {
- InspectorTest.dumpReadDirectoryResult(requestId, errorCode, entries);
+ function step6(errorCode, entries) {
+ InspectorTest.dumpReadDirectoryResult(errorCode, entries);
InspectorTest.clearFileSystem(step7);
}
Modified: trunk/Source/WebCore/ChangeLog (120905 => 120906)
--- trunk/Source/WebCore/ChangeLog 2012-06-21 06:08:47 UTC (rev 120905)
+++ trunk/Source/WebCore/ChangeLog 2012-06-21 07:23:48 UTC (rev 120906)
@@ -1,3 +1,34 @@
+2012-06-21 Taiju Tsuiki <[email protected]>
+
+ Web Inspector: Move requestId allocation from FileSystem frontend to backend
+ https://bugs.webkit.org/show_bug.cgi?id=89555
+
+ Reviewed by Vsevolod Vlasov.
+
+ Test: http/tests/inspector/filesystem/get-filesystem-root.html:
+ http/tests/inspector/filesystem/read-directory.html:
+
+ * inspector/Inspector.json:
+ * inspector/InspectorFileSystemAgent.cpp:
+ (WebCore):
+ (WebCore::InspectorFileSystemAgent::requestFileSystemRoot):
+ (WebCore::InspectorFileSystemAgent::requestDirectoryContent):
+ (WebCore::InspectorFileSystemAgent::InspectorFileSystemAgent):
+ * inspector/InspectorFileSystemAgent.h:
+ (InspectorFileSystemAgent):
+ * inspector/front-end/FileSystemModel.js:
+ (WebInspector.FileSystemModel.prototype._originAdded):
+ (WebInspector.FileSystemModel.prototype._fileSystemRootReceived):
+ (WebInspector.FileSystemRequestManager):
+ (WebInspector.FileSystemRequestManager.prototype.requestFileSystemRoot.requestAccepted):
+ (WebInspector.FileSystemRequestManager.prototype.requestFileSystemRoot):
+ (WebInspector.FileSystemRequestManager.prototype._fileSystemRootReceived):
+ (WebInspector.FileSystemRequestManager.prototype.requestDirectoryContent.requestAccepted):
+ (WebInspector.FileSystemRequestManager.prototype.requestDirectoryContent):
+ (WebInspector.FileSystemRequestManager.prototype._directoryContentReceived):
+ (WebInspector.FileSystemDispatcher.prototype.fileSystemRootReceived):
+ (WebInspector.FileSystemDispatcher.prototype.directoryContentReceived):
+
2012-06-20 Arnaud Renevier <[email protected]>
[cairo] improve putByteArray speed by avoiding max/min checks at Color construction.
Modified: trunk/Source/WebCore/inspector/Inspector.json (120905 => 120906)
--- trunk/Source/WebCore/inspector/Inspector.json 2012-06-21 06:08:47 UTC (rev 120905)
+++ trunk/Source/WebCore/inspector/Inspector.json 2012-06-21 07:23:48 UTC (rev 120906)
@@ -617,7 +617,7 @@
"name": "addInspectedHeapObject",
"parameters": [
{ "name": "heapObjectId", "type": "integer" }
- ]
+ ]
}
],
"events": [
@@ -1405,6 +1405,11 @@
"hidden": true,
"types": [
{
+ "id": "RequestId",
+ "type": "integer",
+ "description": "Request Identifier to glue a request and its completion event."
+ },
+ {
"id": "Entry",
"type": "object",
"properties": [
@@ -1427,41 +1432,45 @@
"description": "Disables events from backend."
},
{
- "name": "getFileSystemRoot",
+ "name": "requestFileSystemRoot",
"parameters": [
- { "name": "requestId", "type": "integer", "description": "Request Identifier of the command. The backend should pass back this value on corresponding gotFileSystemRoot event." },
{ "name": "origin", "type": "string", "description": "Security origin of requesting FileSystem. One of frames in current page needs to have this security origin." },
{ "name": "type", "type": "string", "enum": ["temporary", "persistent"], "description": "FileSystem type of requesting FileSystem." }
],
- "description": "Returns root directory of the FileSystem if exists."
+ "returns": [
+ { "name": "requestId", "$ref": "RequestId", "description": "Request identifier. Corresponding fileSystemRootReceived event should have same requestId with this." }
+ ],
+ "description": "Returns root directory of the FileSystem as fileSystemRootReceived event, if exists."
},
{
- "name": "readDirectory",
+ "name": "requestDirectoryContent",
"parameters": [
- { "name": "requestId", "type": "integer", "description": "Request Identifier of the command. The backend should pass back this value on corresponding didReadDirectory event." },
{ "name": "url", "type": "string", "description": "URL of the directory that the frontend is requesting to read from." }
],
- "description": "Requests to read the directory content. Result should return on didReadDirectory event with request id."
+ "returns": [
+ { "name": "requestId", "$ref": "RequestId", "description": "Request identifier. Corresponding directoryContentReceived event should have same requestId with this." }
+ ],
+ "description": "Returns content of the directory as directoryContentReceived event."
}
],
"events": [
{
- "name": "gotFileSystemRoot",
+ "name": "fileSystemRootReceived",
"parameters": [
- { "name": "requestId", "type": "integer", "description": "Request Identifier that was passed to corresponding getFileSystemRoot command." },
+ { "name": "requestId", "type": "integer", "description": "Request Identifier that was returned by corresponding requestFileSystemRoot command." },
{ "name": "errorCode", "type": "integer", "description": "0, if no error. Otherwise, errorCode is set to FileError::ErrorCode value." },
{ "name": "root", "$ref": "FileSystem.Entry", "optional": true, "description": "Contains root of the requested FileSystem if the command completed successfully." }
],
- "description": "Completion event of getFileSystemRoot command."
+ "description": "Completion event of requestFileSystemRoot command."
},
{
- "name": "didReadDirectory",
+ "name": "directoryContentReceived",
"parameters": [
- { "name": "requestId", "type": "integer", "description": "Request Identifier that was passed to corresponding readDirectory request." },
+ { "name": "requestId", "type": "integer", "description": "Request Identifier that was returned by corresponding requestDirectoryContent command." },
{ "name": "errorCode", "type": "integer", "description": "0, if no error. Otherwise, errorCode is set to FileError::ErrorCode value." },
{ "name": "entries", "type": "array", "items": { "$ref": "FileSystem.Entry" }, "optional": true, "description": "Contains all entries on directory if the command completed successfully." }
],
- "description": "Completion event of readDirectory command."
+ "description": "Completion event of requestDirectoryContent command."
}
]
},
Modified: trunk/Source/WebCore/inspector/InspectorFileSystemAgent.cpp (120905 => 120906)
--- trunk/Source/WebCore/inspector/InspectorFileSystemAgent.cpp 2012-06-21 06:08:47 UTC (rev 120905)
+++ trunk/Source/WebCore/inspector/InspectorFileSystemAgent.cpp 2012-06-21 07:23:48 UTC (rev 120906)
@@ -116,7 +116,7 @@
{
if (!m_frontendProvider || !m_frontendProvider->frontend())
return;
- m_frontendProvider->frontend()->gotFileSystemRoot(m_requestId, static_cast<int>(errorCode), entry);
+ m_frontendProvider->frontend()->fileSystemRootReceived(m_requestId, static_cast<int>(errorCode), entry);
m_frontendProvider = 0;
}
@@ -222,7 +222,7 @@
{
if (!m_frontendProvider || !m_frontendProvider->frontend())
return;
- m_frontendProvider->frontend()->didReadDirectory(m_requestId, static_cast<int>(errorCode), entries);
+ m_frontendProvider->frontend()->directoryContentReceived(m_requestId, static_cast<int>(errorCode), entries);
m_frontendProvider = 0;
}
@@ -408,28 +408,31 @@
m_state->setBoolean(FileSystemAgentState::fileSystemAgentEnabled, m_enabled);
}
-void InspectorFileSystemAgent::getFileSystemRoot(ErrorString*, int requestId, const String& origin, const String& type)
+void InspectorFileSystemAgent::requestFileSystemRoot(ErrorString* error, const String& origin, const String& type, int* requestId)
{
if (!m_enabled || !m_frontendProvider)
return;
ASSERT(m_frontendProvider->frontend());
+ *requestId = m_nextRequestId++;
if (ScriptExecutionContext* scriptExecutionContext = scriptExecutionContextForOrigin(SecurityOrigin::createFromString(origin).get()))
- GetFileSystemRootTask::create(m_frontendProvider, requestId, type)->start(scriptExecutionContext);
+ GetFileSystemRootTask::create(m_frontendProvider, *requestId, type)->start(scriptExecutionContext);
else
- m_frontendProvider->frontend()->gotFileSystemRoot(requestId, static_cast<int>(FileError::ABORT_ERR), 0);
+ m_frontendProvider->frontend()->fileSystemRootReceived(*requestId, static_cast<int>(FileError::ABORT_ERR), 0);
}
-void InspectorFileSystemAgent::readDirectory(ErrorString*, int requestId, const String& url)
+void InspectorFileSystemAgent::requestDirectoryContent(ErrorString*, const String& url, int* requestId)
{
if (!m_enabled || !m_frontendProvider)
return;
ASSERT(m_frontendProvider->frontend());
+ *requestId = m_nextRequestId++;
+
if (ScriptExecutionContext* scriptExecutionContext = scriptExecutionContextForOrigin(SecurityOrigin::createFromString(url).get()))
- ReadDirectoryTask::create(m_frontendProvider, requestId, url)->start(scriptExecutionContext);
+ ReadDirectoryTask::create(m_frontendProvider, *requestId, url)->start(scriptExecutionContext);
else
- m_frontendProvider->frontend()->didReadDirectory(requestId, static_cast<int>(FileError::ABORT_ERR), 0);
+ m_frontendProvider->frontend()->directoryContentReceived(*requestId, static_cast<int>(FileError::ABORT_ERR), 0);
}
void InspectorFileSystemAgent::setFrontend(InspectorFrontend* frontend)
@@ -457,6 +460,7 @@
: InspectorBaseAgent<InspectorFileSystemAgent>("FileSystem", instrumentingAgents, state)
, m_pageAgent(pageAgent)
, m_enabled(false)
+ , m_nextRequestId(1)
{
ASSERT(instrumentingAgents);
ASSERT(state);
Modified: trunk/Source/WebCore/inspector/InspectorFileSystemAgent.h (120905 => 120906)
--- trunk/Source/WebCore/inspector/InspectorFileSystemAgent.h 2012-06-21 06:08:47 UTC (rev 120905)
+++ trunk/Source/WebCore/inspector/InspectorFileSystemAgent.h 2012-06-21 07:23:48 UTC (rev 120906)
@@ -59,8 +59,8 @@
virtual void enable(ErrorString*) OVERRIDE;
virtual void disable(ErrorString*) OVERRIDE;
- virtual void getFileSystemRoot(ErrorString*, int requestId, const String& origin, const String& type) OVERRIDE;
- virtual void readDirectory(ErrorString*, int requestId, const String& url) OVERRIDE;
+ virtual void requestFileSystemRoot(ErrorString*, const String& origin, const String& type, int* requestId) OVERRIDE;
+ virtual void requestDirectoryContent(ErrorString*, const String& url, int* requestId) OVERRIDE;
virtual void setFrontend(InspectorFrontend*) OVERRIDE;
virtual void clearFrontend() OVERRIDE;
@@ -73,6 +73,7 @@
InspectorPageAgent* m_pageAgent;
RefPtr<FrontendProvider> m_frontendProvider;
bool m_enabled;
+ int m_nextRequestId;
};
} // namespace WebCore
Modified: trunk/Source/WebCore/inspector/front-end/FileSystemModel.js (120905 => 120906)
--- trunk/Source/WebCore/inspector/front-end/FileSystemModel.js 2012-06-21 06:08:47 UTC (rev 120905)
+++ trunk/Source/WebCore/inspector/front-end/FileSystemModel.js 2012-06-21 07:23:48 UTC (rev 120906)
@@ -148,7 +148,7 @@
var types = ["persistent", "temporary"];
for (var i = 0; i < types.length; ++i)
- this._agentWrapper.getFileSystemRoot(origin, types[i], this._gotFileSystem.bind(this, origin, types[i], this._fileSystemsForOrigin[origin]));
+ this._agentWrapper.requestFileSystemRoot(origin, types[i], this._fileSystemRootReceived.bind(this, origin, types[i], this._fileSystemsForOrigin[origin]));
},
/**
@@ -195,7 +195,7 @@
* @param {number} errorCode
* @param {FileSystemAgent.Entry=} backendRootEntry
*/
- _gotFileSystem: function(origin, type, store, errorCode, backendRootEntry)
+ _fileSystemRootReceived: function(origin, type, store, errorCode, backendRootEntry)
{
if (errorCode === 0 && backendRootEntry && this._fileSystemsForOrigin[origin] === store) {
var fileSystem = new WebInspector.FileSystemModel.FileSystem(this, origin, type, backendRootEntry);
@@ -237,34 +237,29 @@
*/
WebInspector.FileSystemRequestManager = function()
{
- this._pendingGetFileSystemRootRequests = {};
- this._pendingReadDirectoryRequests = {};
+ this._pendingFileSystemRootRequests = {};
+ this._pendingDirectoryContentRequests = {};
InspectorBackend.registerFileSystemDispatcher(new WebInspector.FileSystemDispatcher(this));
FileSystemAgent.enable();
}
-WebInspector.FileSystemRequestManager.nextRequestId = 1;
-
WebInspector.FileSystemRequestManager.prototype = {
/**
- * @return {number}
- */
- _requestId: function()
- {
- return WebInspector.FileSystemRequestManager.nextRequestId++;
- },
-
- /**
* @param {string} origin
* @param {string} type
* @param {function(number, FileSystemAgent.Entry)} callback
*/
- getFileSystemRoot: function(origin, type, callback)
+ requestFileSystemRoot: function(origin, type, callback)
{
- var requestId = this._requestId();
- this._pendingGetFileSystemRootRequests[requestId] = callback;
- FileSystemAgent.getFileSystemRoot(requestId, origin, type);
+ var store = this._pendingFileSystemRootRequests;
+ FileSystemAgent.requestFileSystemRoot(origin, type, requestAccepted);
+
+ function requestAccepted(error, requestId)
+ {
+ if (!error)
+ store[requestId] = callback;
+ }
},
/**
@@ -272,12 +267,12 @@
* @param {number} errorCode
* @param {FileSystemAgent.Entry=} backendRootEntry
*/
- _gotFileSystemRoot: function(requestId, errorCode, backendRootEntry)
+ _fileSystemRootReceived: function(requestId, errorCode, backendRootEntry)
{
- var callback = this._pendingGetFileSystemRootRequests[requestId];
+ var callback = this._pendingFileSystemRootRequests[requestId];
if (!callback)
return;
- delete this._pendingGetFileSystemRootRequests[requestId];
+ delete this._pendingFileSystemRootRequests[requestId];
callback(errorCode, backendRootEntry);
},
@@ -285,11 +280,16 @@
* @param {string} url
* @param {function(number, Array.<FileSystemAgent.Entry>=)} callback
*/
- readDirectory: function(url, callback)
+ requestDirectoryContent: function(url, callback)
{
- var requestId = this.requestId();
- this._pendingReadDirectoryRequests[requestId] = callback;
- FileSystemAgent.readDirectory(requestId, url);
+ var store = this._pendingDirectoryContentRequests;
+ FileSystemAgent.requestDirectoryContent(url, requestAccepted);
+
+ function requestAccepted(error, requestId)
+ {
+ if (!error)
+ store[requestId] = callback;
+ }
},
/**
@@ -297,12 +297,12 @@
* @param {number} errorCode
* @param {Array.<FileSystemAgent.Entry>=} backendEntries
*/
- _didReadDirectory: function(requestId, errorCode, backendEntries)
+ _directoryContentReceived: function(requestId, errorCode, backendEntries)
{
- var callback = /** @type {function(number, Array.<FileSystemAgent.Entry>=)} */ this._pendingReadDirectoryRequests[requestId];
+ var callback = /** @type {function(number, Array.<FileSystemAgent.Entry>=)} */ this._pendingDirectoryContentRequests[requestId];
if (!callback)
return;
- delete this._pendingReadDirectoryRequests[requestId];
+ delete this._pendingDirectoryContentRequests[requestId];
callback(errorCode, backendEntries);
}
}
@@ -323,9 +323,9 @@
* @param {number} errorCode
* @param {FileSystemAgent.Entry=} backendRootEntry
*/
- gotFileSystemRoot: function(requestId, errorCode, backendRootEntry)
+ fileSystemRootReceived: function(requestId, errorCode, backendRootEntry)
{
- this._agentWrapper._gotFileSystemRoot(requestId, errorCode, backendRootEntry);
+ this._agentWrapper._fileSystemRootReceived(requestId, errorCode, backendRootEntry);
},
/**
@@ -333,8 +333,8 @@
* @param {number} errorCode
* @param {Array.<FileSystemAgent.Entry>=} backendEntries
*/
- didReadDirectory: function(requestId, errorCode, backendEntries)
+ directoryContentReceived: function(requestId, errorCode, backendEntries)
{
- this._agentWrapper._didReadDirectory(requestId, errorCode, backendEntries);
+ this._agentWrapper._directoryContentReceived(requestId, errorCode, backendEntries);
}
}