Changeset 35842 in webkit
- Timestamp:
- Aug 19, 2008 11:33:27 AM (16 years ago)
- Location:
- trunk/WebCore
- Files:
-
- 6 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/WebCore/ChangeLog
r35841 r35842 1 2008-08-19 Keishi Hattori <casey.hattori@gmail.com> 2 3 Added support for console.count in the inspector. 4 5 Reviewed by Geoff Garen. 6 7 * page/Console.cpp: 8 (WebCore::Console::count): 9 * page/Console.h: 10 * page/Console.idl: Added console.count. 11 * page/InspectorController.cpp: 12 (WebCore::InspectorController::didCommitLoad): Clears m_counts. 13 (WebCore::InspectorController::count): Updates the count number 14 sing "title@source:line" as the identifier, and adds a 15 message to the console. 16 * page/InspectorController.h: Added m_counts. 17 1 18 2008-08-19 Keishi Hattori <casey.hattori@gmail.com> 2 19 -
trunk/WebCore/page/Console.cpp
r35833 r35842 262 262 } 263 263 264 void Console::count(const UString& title) 265 { 266 if (!m_frame) 267 return; 268 269 Page* page = m_frame->page(); 270 if (!page) 271 return; 272 273 // FIXME: pass the file and line number to the InspectorController 274 // when we have this information. 275 page->inspectorController()->count(title, 0, String()); 276 } 277 264 278 void Console::profile(ExecState* exec, const ArgList& args) 265 279 { -
trunk/WebCore/page/Console.h
r35833 r35842 81 81 void dir(KJS::ExecState*, const KJS::ArgList& arguments); 82 82 void assertCondition(bool condition, KJS::ExecState*, const KJS::ArgList& arguments); 83 void count(const KJS::UString& title); 83 84 void profile(KJS::ExecState*, const KJS::ArgList& arguments); 84 85 void profileEnd(KJS::ExecState*, const KJS::ArgList& arguments); -
trunk/WebCore/page/Console.idl
r35787 r35842 37 37 [Custom] void dir(); 38 38 [Custom, ImplementationFunction=assertCondition] void assert(in boolean condition); 39 void count(in [ConvertUndefinedOrNullToNullString] DOMString title); 39 40 40 41 [Custom] void profile(in DOMString title); -
trunk/WebCore/page/InspectorController.cpp
r35841 r35842 2087 2087 2088 2088 m_times.clear(); 2089 m_counts.clear(); 2089 2090 m_profiles.clear(); 2090 2091 … … 2564 2565 } 2565 2566 2567 void InspectorController::count(const UString& title, unsigned lineNumber, const String& sourceID) 2568 { 2569 String identifier = String(title) + String::format("@%s:%d", sourceID.utf8().data(), lineNumber); 2570 HashMap<String, unsigned>::iterator it = m_counts.find(identifier); 2571 int count; 2572 if (it == m_counts.end()) 2573 count = 1; 2574 else { 2575 count = it->second + 1; 2576 m_counts.remove(it); 2577 } 2578 2579 m_counts.add(identifier, count); 2580 2581 String message = String::format("%s: %d", title.UTF8String().c_str(), count); 2582 addMessageToConsole(JSMessageSource, LogMessageLevel, message, lineNumber, sourceID); 2583 } 2584 2566 2585 void InspectorController::startTiming(const UString& title) 2567 2586 { -
trunk/WebCore/page/InspectorController.h
r35788 r35842 178 178 void drawNodeHighlight(GraphicsContext&) const; 179 179 180 void count(const KJS::UString& title, unsigned lineNumber, const String& sourceID); 181 180 182 void startTiming(const KJS::UString& title); 181 183 bool stopTiming(const KJS::UString& title, double& elapsed); … … 234 236 Vector<RefPtr<KJS::Profile> > m_profiles; 235 237 HashMap<String, double> m_times; 238 HashMap<String, unsigned> m_counts; 236 239 #if ENABLE(DATABASE) 237 240 DatabaseResourcesSet m_databaseResources;
Note: See TracChangeset
for help on using the changeset viewer.