Changeset 76335 in webkit
- Timestamp:
- Jan 21, 2011 1:24:44 AM (13 years ago)
- Location:
- trunk/Source/WebCore
- Files:
-
- 6 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WebCore/ChangeLog
r76330 r76335 1 2011-01-21 Ilya Tikhonovsky <loislo@chromium.org> 2 3 Reviewed by Yury Semikhatsky. 4 5 Web Inspector: switch page/Console implementation from InspectorController to InspectorInstrumentation. 6 7 There are some places in WebCore where we still using direct InspectorController calls. 8 The idea is to pass all the Inspector related calls via InspectorInstrumentaion which is the 9 Inspector facade for WebCore. 10 11 https://bugs.webkit.org/show_bug.cgi?id=52869 12 13 * inspector/InspectorController.cpp: 14 * inspector/InspectorController.h: 15 * inspector/InspectorInstrumentation.cpp: 16 (WebCore::InspectorInstrumentation::addProfileImpl): 17 (WebCore::InspectorInstrumentation::profilerEnabledImpl): 18 (WebCore::InspectorInstrumentation::getCurrentUserInitiatedProfileNameImpl): 19 * inspector/InspectorInstrumentation.h: 20 (WebCore::InspectorInstrumentation::addProfile): 21 (WebCore::InspectorInstrumentation::profilerEnabled): 22 (WebCore::InspectorInstrumentation::getCurrentUserInitiatedProfileName): 23 * page/Console.cpp: 24 (WebCore::Console::profile): 25 (WebCore::Console::profileEnd): 26 1 27 2011-01-20 Sam Weinig <sam@webkit.org> 2 28 -
trunk/Source/WebCore/inspector/InspectorController.cpp
r76249 r76335 984 984 985 985 #if ENABLE(JAVASCRIPT_DEBUGGER) 986 void InspectorController::addProfile(PassRefPtr<ScriptProfile> prpProfile, unsigned lineNumber, const String& sourceURL)987 {988 if (!enabled())989 return;990 m_profilerAgent->addProfile(prpProfile, lineNumber, sourceURL);991 }992 993 986 bool InspectorController::isRecordingUserInitiatedProfile() const 994 987 { 995 988 return m_profilerAgent->isRecordingUserInitiatedProfile(); 996 }997 998 String InspectorController::getCurrentUserInitiatedProfileName(bool incrementProfileNumber)999 {1000 return m_profilerAgent->getCurrentUserInitiatedProfileName(incrementProfileNumber);1001 989 } 1002 990 -
trunk/Source/WebCore/inspector/InspectorController.h
r76249 r76335 228 228 229 229 #if ENABLE(JAVASCRIPT_DEBUGGER) 230 void addProfile(PassRefPtr<ScriptProfile>, unsigned lineNumber, const String& sourceURL);231 230 bool isRecordingUserInitiatedProfile() const; 232 String getCurrentUserInitiatedProfileName(bool incrementProfileNumber = false);233 231 void startProfiling() { startUserInitiatedProfiling(); } 234 232 void startUserInitiatedProfiling(); -
trunk/Source/WebCore/inspector/InspectorInstrumentation.cpp
r76240 r76335 553 553 profilerAgent->addStartProfilingMessageToConsole(title, lineNumber, sourceURL); 554 554 } 555 556 void InspectorInstrumentation::addProfileImpl(InspectorController* inspectorController, RefPtr<ScriptProfile> profile, ScriptCallStack* callStack) 557 { 558 if (InspectorProfilerAgent* profilerAgent = inspectorController->profilerAgent()) { 559 const ScriptCallFrame& lastCaller = callStack->at(0); 560 profilerAgent->addProfile(profile, lastCaller.lineNumber(), lastCaller.sourceURL()); 561 } 562 } 563 564 bool InspectorInstrumentation::profilerEnabledImpl(InspectorController* inspectorController) 565 { 566 if (inspectorController->enabled()) 567 return false; 568 569 InspectorProfilerAgent* profilerAgent = inspectorController->profilerAgent(); 570 if (!profilerAgent) 571 return false; 572 573 return profilerAgent->enabled(); 574 } 575 576 String InspectorInstrumentation::getCurrentUserInitiatedProfileNameImpl(InspectorController* inspectorController, bool incrementProfileNumber) 577 { 578 if (InspectorProfilerAgent* profilerAgent = inspectorController->profilerAgent()) 579 return profilerAgent->getCurrentUserInitiatedProfileName(incrementProfileNumber); 580 return ""; 581 } 555 582 #endif 556 583 -
trunk/Source/WebCore/inspector/InspectorInstrumentation.h
r75933 r76335 140 140 #if ENABLE(JAVASCRIPT_DEBUGGER) 141 141 static void addStartProfilingMessageToConsole(Page*, const String& title, unsigned lineNumber, const String& sourceURL); 142 static void addProfile(Page*, RefPtr<ScriptProfile>, ScriptCallStack*); 143 static bool profilerEnabled(Page*); 144 static String getCurrentUserInitiatedProfileName(Page*, bool incrementProfileNumber); 142 145 #endif 143 146 … … 247 250 #if ENABLE(JAVASCRIPT_DEBUGGER) 248 251 static void addStartProfilingMessageToConsoleImpl(InspectorController*, const String& title, unsigned lineNumber, const String& sourceURL); 252 static void addProfileImpl(InspectorController*, RefPtr<ScriptProfile>, ScriptCallStack*); 253 static bool profilerEnabledImpl(InspectorController*); 254 static String getCurrentUserInitiatedProfileNameImpl(InspectorController*, bool incrementProfileNumber); 249 255 #endif 250 256 … … 882 888 #endif 883 889 } 890 891 inline void InspectorInstrumentation::addProfile(Page* page, RefPtr<ScriptProfile> profile, ScriptCallStack* callStack) 892 { 893 #if ENABLE(INSPECTOR) 894 if (InspectorController* inspectorController = inspectorControllerForPage(page)) 895 addProfileImpl(inspectorController, profile, callStack); 896 #endif 897 } 898 899 inline bool InspectorInstrumentation::profilerEnabled(Page* page) 900 { 901 #if ENABLE(INSPECTOR) 902 if (InspectorController* inspectorController = inspectorControllerForPage(page)) 903 return profilerEnabledImpl(inspectorController); 904 #endif 905 return false; 906 } 907 908 inline String InspectorInstrumentation::getCurrentUserInitiatedProfileName(Page* page, bool incrementProfileNumber) 909 { 910 #if ENABLE(INSPECTOR) 911 if (InspectorController* inspectorController = inspectorControllerForPage(page)) 912 return InspectorInstrumentation::getCurrentUserInitiatedProfileNameImpl(inspectorController, incrementProfileNumber); 913 #endif 914 return ""; 915 } 884 916 #endif 885 917 … … 937 969 return 0; 938 970 } 971 939 972 #endif 940 973 -
trunk/Source/WebCore/page/Console.cpp
r75932 r76335 263 263 return; 264 264 265 #if ENABLE(INSPECTOR)266 InspectorController* controller = page->inspectorController();267 265 // FIXME: log a console message when profiling is disabled. 268 if (!controller->profilerEnabled()) 269 return; 270 #endif 266 if (!InspectorInstrumentation::profilerEnabled(page)) 267 return; 271 268 272 269 String resolvedTitle = title; 273 270 if (title.isNull()) // no title so give it the next user initiated profile title. 274 #if ENABLE(INSPECTOR) 275 resolvedTitle = controller->getCurrentUserInitiatedProfileName(true); 276 #else 277 resolvedTitle = ""; 278 #endif 271 resolvedTitle = InspectorInstrumentation::getCurrentUserInitiatedProfileName(page, true); 279 272 280 273 ScriptProfiler::start(state, resolvedTitle); … … 290 283 return; 291 284 292 #if ENABLE(INSPECTOR) 293 InspectorController* controller = page->inspectorController(); 294 if (!controller->profilerEnabled()) 295 return; 296 #endif 285 if (!InspectorInstrumentation::profilerEnabled(page)) 286 return; 297 287 298 288 RefPtr<ScriptProfile> profile = ScriptProfiler::stop(state, title); … … 301 291 302 292 m_profiles.append(profile); 303 304 #if ENABLE(INSPECTOR) 305 const ScriptCallFrame& lastCaller = callStack->at(0); 306 controller->addProfile(profile, lastCaller.lineNumber(), lastCaller.sourceURL()); 307 #endif 293 InspectorInstrumentation::addProfile(page, profile, callStack.get()); 308 294 } 309 295
Note: See TracChangeset
for help on using the changeset viewer.