Changeset 51439 in webkit
- Timestamp:
- Nov 27, 2009 3:12:44 AM (14 years ago)
- Location:
- trunk/WebCore
- Files:
-
- 18 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/WebCore/ChangeLog
r51429 r51439 1 2009-11-27 Yury Semikhatsky <yurys@chromium.org> 2 3 Reviewed by Pavel Feldman. 4 5 Instead of generating negative identifiers for cached resources in 6 InspectorController and extending identifier type from 'unsigned long' to 'long 7 long' reuse progress tracker from the inspected page to generate those 8 identifiers. It guarantees that InspectorResources have unique ids since 9 all of them are generated by that progress tracker. 10 11 Added a couple new overloaded methods to Script* objects that accept 12 long and unsigned long arguments. These types of argumens have already 13 been passed as long long. 14 15 https://bugs.webkit.org/show_bug.cgi?id=31921 16 17 * bindings/js/ScriptFunctionCall.cpp: 18 (WebCore::ScriptFunctionCall::appendArgument): 19 * bindings/js/ScriptFunctionCall.h: 20 * bindings/js/ScriptObject.cpp: 21 (WebCore::ScriptObject::set): 22 * bindings/js/ScriptObject.h: 23 * bindings/v8/ScriptFunctionCall.cpp: 24 (WebCore::ScriptFunctionCall::appendArgument): 25 * bindings/v8/ScriptFunctionCall.h: 26 * bindings/v8/ScriptObject.cpp: 27 (WebCore::ScriptObject::set): 28 * bindings/v8/ScriptObject.h: 29 * inspector/InspectorBackend.cpp: 30 (WebCore::InspectorBackend::dispatchOnInjectedScript): 31 * inspector/InspectorController.cpp: 32 (WebCore::InspectorController::InspectorController): 33 (WebCore::InspectorController::getTrackedResource): 34 (WebCore::InspectorController::didLoadResourceFromMemoryCache): Use inspected page's ProgressTracker to generate unique identifiers for cached resources in InspectorController. 35 * inspector/InspectorController.h: 36 * inspector/InspectorDOMAgent.cpp: 37 (WebCore::InspectorDOMAgent::buildObjectForNode): 38 (WebCore::InspectorDOMAgent::buildObjectForEventListener): 39 * inspector/InspectorFrontend.cpp: 40 (WebCore::InspectorFrontend::addResource): 41 (WebCore::InspectorFrontend::updateResource): 42 (WebCore::InspectorFrontend::removeResource): 43 (WebCore::InspectorFrontend::updateFocusedNode): 44 * inspector/InspectorFrontend.h: 45 * inspector/InspectorResource.cpp: 46 (WebCore::InspectorResource::InspectorResource): 47 (WebCore::InspectorResource::createCached): 48 * inspector/InspectorResource.h: Change InspectorResource identifier type from 'long long' to 'unsigned long'. 49 (WebCore::InspectorResource::create): 50 (WebCore::InspectorResource::identifier): 51 * inspector/TimelineRecordFactory.cpp: 52 (WebCore::TimelineRecordFactory::createResourceSendRequestRecord): 53 (WebCore::TimelineRecordFactory::createResourceReceiveResponseRecord): 54 (WebCore::TimelineRecordFactory::createResourceFinishRecord): 55 1 56 2009-11-26 Shinichiro Hamaji <hamaji@chromium.org> 2 57 -
trunk/WebCore/bindings/js/ScriptFunctionCall.cpp
r49963 r51439 81 81 } 82 82 83 void ScriptFunctionCall::appendArgument(long argument) 84 { 85 JSLock lock(SilenceAssertionsOnly); 86 m_arguments.append(jsNumber(m_exec, argument)); 87 } 88 83 89 void ScriptFunctionCall::appendArgument(long long argument) 84 90 { … … 88 94 89 95 void ScriptFunctionCall::appendArgument(unsigned int argument) 96 { 97 JSLock lock(SilenceAssertionsOnly); 98 m_arguments.append(jsNumber(m_exec, argument)); 99 } 100 101 void ScriptFunctionCall::appendArgument(unsigned long argument) 90 102 { 91 103 JSLock lock(SilenceAssertionsOnly); -
trunk/WebCore/bindings/js/ScriptFunctionCall.h
r43122 r51439 58 58 void appendArgument(const JSC::UString&); 59 59 void appendArgument(JSC::JSValue); 60 void appendArgument(long); 60 61 void appendArgument(long long); 61 62 void appendArgument(unsigned int); 63 void appendArgument(unsigned long); 62 64 void appendArgument(int); 63 65 void appendArgument(bool); -
trunk/WebCore/bindings/js/ScriptObject.cpp
r50848 r51439 91 91 } 92 92 93 bool ScriptObject::set(const char* name, long value) 94 { 95 JSLock lock(SilenceAssertionsOnly); 96 PutPropertySlot slot; 97 jsObject()->put(m_scriptState, Identifier(m_scriptState, name), jsNumber(m_scriptState, value), slot); 98 return handleException(m_scriptState); 99 } 100 93 101 bool ScriptObject::set(const char* name, long long value) 94 102 { … … 108 116 109 117 bool ScriptObject::set(const char* name, unsigned value) 118 { 119 JSLock lock(SilenceAssertionsOnly); 120 PutPropertySlot slot; 121 jsObject()->put(m_scriptState, Identifier(m_scriptState, name), jsNumber(m_scriptState, value), slot); 122 return handleException(m_scriptState); 123 } 124 125 bool ScriptObject::set(const char* name, unsigned long value) 110 126 { 111 127 JSLock lock(SilenceAssertionsOnly); -
trunk/WebCore/bindings/js/ScriptObject.h
r49263 r51439 51 51 bool set(const char* name, const String&); 52 52 bool set(const char* name, double); 53 bool set(const char* name, long); 53 54 bool set(const char* name, long long); 54 55 bool set(const char* name, int); 55 56 bool set(const char* name, unsigned); 57 bool set(const char* name, unsigned long); 56 58 bool set(const char* name, bool); 57 59 -
trunk/WebCore/bindings/v8/ScriptFunctionCall.cpp
r48072 r51439 75 75 } 76 76 77 void ScriptFunctionCall::appendArgument(long argument) 78 { 79 ScriptScope scope(m_scriptState); 80 m_arguments.append(v8::Number::New(argument)); 81 } 82 77 83 void ScriptFunctionCall::appendArgument(long long argument) 78 84 { … … 82 88 83 89 void ScriptFunctionCall::appendArgument(unsigned int argument) 90 { 91 ScriptScope scope(m_scriptState); 92 m_arguments.append(v8::Number::New(argument)); 93 } 94 95 void ScriptFunctionCall::appendArgument(unsigned long argument) 84 96 { 85 97 ScriptScope scope(m_scriptState); -
trunk/WebCore/bindings/v8/ScriptFunctionCall.h
r42568 r51439 51 51 void appendArgument(const ScriptValue&); 52 52 void appendArgument(const String&); 53 void appendArgument(long); 53 54 void appendArgument(long long); 54 55 void appendArgument(unsigned int); 56 void appendArgument(unsigned long); 55 57 void appendArgument(int); 56 58 void appendArgument(bool); -
trunk/WebCore/bindings/v8/ScriptObject.cpp
r49262 r51439 84 84 } 85 85 86 bool ScriptObject::set(const char* name, long value) 87 { 88 ScriptScope scope(m_scriptState); 89 v8Object()->Set(v8::String::New(name), v8::Number::New(value)); 90 return scope.success(); 91 } 92 86 93 bool ScriptObject::set(const char* name, long long value) 87 94 { … … 99 106 100 107 bool ScriptObject::set(const char* name, unsigned value) 108 { 109 ScriptScope scope(m_scriptState); 110 v8Object()->Set(v8::String::New(name), v8::Number::New(value)); 111 return scope.success(); 112 } 113 114 bool ScriptObject::set(const char* name, unsigned long value) 101 115 { 102 116 ScriptScope scope(m_scriptState); -
trunk/WebCore/bindings/v8/ScriptObject.h
r49262 r51439 52 52 bool set(const char* name, const String&); 53 53 bool set(const char* name, double); 54 bool set(const char* name, long); 54 55 bool set(const char* name, long long); 55 56 bool set(const char* name, int); 56 57 bool set(const char* name, unsigned); 58 bool set(const char* name, unsigned long); 57 59 bool set(const char* name, bool); 58 60 -
trunk/WebCore/inspector/InspectorBackend.cpp
r50639 r51439 415 415 function.appendArgument(arguments); 416 416 if (async) 417 function.appendArgument( static_cast<int>(callId));417 function.appendArgument(callId); 418 418 bool hadException = false; 419 419 ScriptValue result = function.call(hadException); -
trunk/WebCore/inspector/InspectorController.cpp
r51422 r51439 63 63 #include "JavaScriptProfile.h" 64 64 #include "Page.h" 65 #include "ProgressTracker.h" 65 66 #include "Range.h" 66 67 #include "RenderInline.h" … … 129 130 , m_windowVisible(false) 130 131 , m_showAfterVisible(CurrentPanel) 131 , m_nextIdentifier(-2)132 132 , m_groupLevel(0) 133 133 , m_searchingForNode(false) … … 842 842 } 843 843 844 InspectorResource* InspectorController::getTrackedResource( longlong identifier)844 InspectorResource* InspectorController::getTrackedResource(unsigned long identifier) 845 845 { 846 846 if (!enabled()) … … 872 872 return; 873 873 874 RefPtr<InspectorResource> resource = InspectorResource::createCached(m_ nextIdentifier--, loader, cachedResource);874 RefPtr<InspectorResource> resource = InspectorResource::createCached(m_inspectedPage->progress()->createUniqueIdentifier() , loader, cachedResource); 875 875 876 876 if (isMainResource) { … … 1610 1610 ScriptGlobalObject::get(scriptState, "window", window); 1611 1611 ScriptFunctionCall function(scriptState, window, "didEvaluateForTestInFrontend"); 1612 function.appendArgument( static_cast<int>(callId));1612 function.appendArgument(callId); 1613 1613 function.appendArgument(jsonResult); 1614 1614 function.call(); -
trunk/WebCore/inspector/InspectorController.h
r51422 r51439 92 92 { 93 93 public: 94 typedef HashMap< longlong, RefPtr<InspectorResource> > ResourcesMap;94 typedef HashMap<unsigned long, RefPtr<InspectorResource> > ResourcesMap; 95 95 typedef HashMap<RefPtr<Frame>, ResourcesMap*> FrameResourcesMap; 96 96 typedef HashMap<int, RefPtr<InspectorDatabaseResource> > DatabaseResourcesMap; … … 344 344 void addResource(InspectorResource*); 345 345 void removeResource(InspectorResource*); 346 InspectorResource* getTrackedResource( longlong identifier);346 InspectorResource* getTrackedResource(unsigned long identifier); 347 347 348 348 void pruneResources(ResourcesMap*, DocumentLoader* loaderToKeep = 0); … … 381 381 bool m_windowVisible; 382 382 SpecialPanels m_showAfterVisible; 383 long long m_nextIdentifier;384 383 RefPtr<Node> m_highlightedNode; 385 384 unsigned m_groupLevel; -
trunk/WebCore/inspector/InspectorDOMAgent.cpp
r50691 r51439 467 467 } 468 468 469 value.set("id", static_cast<int>(id));469 value.set("id", id); 470 470 value.set("nodeType", node->nodeType()); 471 471 value.set("nodeName", nodeName); … … 534 534 value.set("useCapture", registeredEventListener.useCapture); 535 535 value.set("isAttribute", eventListener->isAttribute()); 536 value.set("nodeId", static_cast<long long>(pushNodePathToFrontend(node)));536 value.set("nodeId", pushNodePathToFrontend(node)); 537 537 value.set("listener", getEventListenerHandlerBody(node->document(), m_frontend->scriptState(), eventListener.get())); 538 538 return value; -
trunk/WebCore/inspector/InspectorFrontend.cpp
r51245 r51439 106 106 } 107 107 108 bool InspectorFrontend::addResource( longlong identifier, const ScriptObject& resourceObj)108 bool InspectorFrontend::addResource(unsigned long identifier, const ScriptObject& resourceObj) 109 109 { 110 110 OwnPtr<ScriptFunctionCall> function(newFunctionCall("addResource")); … … 116 116 } 117 117 118 bool InspectorFrontend::updateResource( longlong identifier, const ScriptObject& resourceObj)118 bool InspectorFrontend::updateResource(unsigned long identifier, const ScriptObject& resourceObj) 119 119 { 120 120 OwnPtr<ScriptFunctionCall> function(newFunctionCall("updateResource")); … … 126 126 } 127 127 128 void InspectorFrontend::removeResource( longlong identifier)128 void InspectorFrontend::removeResource(unsigned long identifier) 129 129 { 130 130 OwnPtr<ScriptFunctionCall> function(newFunctionCall("removeResource")); … … 133 133 } 134 134 135 void InspectorFrontend::updateFocusedNode(long longnodeId)135 void InspectorFrontend::updateFocusedNode(long nodeId) 136 136 { 137 137 OwnPtr<ScriptFunctionCall> function(newFunctionCall("updateFocusedNode")); -
trunk/WebCore/inspector/InspectorFrontend.h
r51182 r51439 68 68 void clearConsoleMessages(); 69 69 70 bool addResource( longlong identifier, const ScriptObject& resourceObj);71 bool updateResource( longlong identifier, const ScriptObject& resourceObj);72 void removeResource( longlong identifier);70 bool addResource(unsigned long identifier, const ScriptObject& resourceObj); 71 bool updateResource(unsigned long identifier, const ScriptObject& resourceObj); 72 void removeResource(unsigned long identifier); 73 73 74 void updateFocusedNode(long longnodeId);74 void updateFocusedNode(long nodeId); 75 75 void setAttachedWindow(bool attached); 76 76 void showPanel(int panel); -
trunk/WebCore/inspector/InspectorResource.cpp
r51422 r51439 47 47 namespace WebCore { 48 48 49 InspectorResource::InspectorResource( longlong identifier, DocumentLoader* loader)49 InspectorResource::InspectorResource(unsigned long identifier, DocumentLoader* loader) 50 50 : m_identifier(identifier) 51 51 , m_loader(loader) … … 71 71 } 72 72 73 PassRefPtr<InspectorResource> InspectorResource::createCached( longlong identifier, DocumentLoader* loader, const CachedResource* cachedResource)73 PassRefPtr<InspectorResource> InspectorResource::createCached(unsigned long identifier, DocumentLoader* loader, const CachedResource* cachedResource) 74 74 { 75 75 PassRefPtr<InspectorResource> resource = create(identifier, loader); -
trunk/WebCore/inspector/InspectorResource.h
r50905 r51439 69 69 }; 70 70 71 static PassRefPtr<InspectorResource> create( longlong identifier, DocumentLoader* loader)71 static PassRefPtr<InspectorResource> create(unsigned long identifier, DocumentLoader* loader) 72 72 { 73 73 return adoptRef(new InspectorResource(identifier, loader)); 74 74 } 75 75 76 static PassRefPtr<InspectorResource> createCached( longlong identifier, DocumentLoader*, const CachedResource*);76 static PassRefPtr<InspectorResource> createCached(unsigned long identifier, DocumentLoader*, const CachedResource*); 77 77 78 78 ~InspectorResource(); … … 92 92 bool isSameLoader(DocumentLoader* loader) const { return loader == m_loader; } 93 93 void markMainResource() { m_isMainResource = true; } 94 longlong identifier() const { return m_identifier; }94 unsigned long identifier() const { return m_identifier; } 95 95 String requestURL() const { return m_requestURL.string(); } 96 96 Frame* frame() const { return m_frame.get(); } … … 146 146 }; 147 147 148 InspectorResource( longlong identifier, DocumentLoader*);148 InspectorResource(unsigned long identifier, DocumentLoader*); 149 149 Type type() const; 150 150 … … 152 152 CachedResource* cachedResource() const; 153 153 154 longlong m_identifier;154 unsigned long m_identifier; 155 155 RefPtr<DocumentLoader> m_loader; 156 156 RefPtr<Frame> m_frame; -
trunk/WebCore/inspector/TimelineRecordFactory.cpp
r50524 r51439 124 124 ScriptObject record = createGenericRecord(frontend, startTime); 125 125 ScriptObject data = frontend->newScriptObject(); 126 data.set("identifier", static_cast<long long>(identifier));126 data.set("identifier", identifier); 127 127 data.set("url", request.url().string()); 128 128 data.set("requestMethod", request.httpMethod()); … … 137 137 ScriptObject record = createGenericRecord(frontend, startTime); 138 138 ScriptObject data = frontend->newScriptObject(); 139 data.set("identifier", static_cast<long long>(identifier));139 data.set("identifier", identifier); 140 140 data.set("statusCode", response.httpStatusCode()); 141 141 data.set("mimeType", response.mimeType()); … … 150 150 ScriptObject record = createGenericRecord(frontend, startTime); 151 151 ScriptObject data = frontend->newScriptObject(); 152 data.set("identifier", static_cast<long long>(identifier));152 data.set("identifier", identifier); 153 153 data.set("didFail", didFail); 154 154 record.set("data", data);
Note: See TracChangeset
for help on using the changeset viewer.