Changeset 146518 in webkit
- Timestamp:
- Mar 21, 2013 2:16:41 PM (11 years ago)
- Location:
- trunk/Source/WebKit2
- Files:
-
- 14 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WebKit2/ChangeLog
r146513 r146518 1 2013-03-21 Timothy Hatcher <timothy@apple.com> 2 3 Support connecting the Web Inspector without showing it. 4 5 This allows you to get the debugger attached in the background. When a breakpoint is hit 6 the Inspector will open. This change also reduces some WebProcess messaging by removing 7 the DidLoadInspectorPage message and stops sending the SetAttachedWindow message on close. 8 9 https://bugs.webkit.org/show_bug.cgi?id=112445 10 11 Reviewed by Sam Weinig. 12 13 * UIProcess/API/C/WKInspector.cpp: 14 (WKInspectorIsConnected): Added. 15 (WKInspectorConnect): Added. 16 (WKInspectorHide): Added. 17 18 * UIProcess/API/C/WKInspector.h: 19 Added new APIs. 20 21 * UIProcess/WebInspectorProxy.cpp: 22 (WebKit::WebInspectorProxy::WebInspectorProxy): 23 Initialize new state booleans. 24 25 (WebKit::WebInspectorProxy::invalidate): 26 Don't set state booleans that didClose already resets. 27 28 (WebKit::WebInspectorProxy::connect): Added. 29 (WebKit::WebInspectorProxy::show): 30 Open if we are already connected. Call connect(). 31 32 (WebKit::WebInspectorProxy::hide): Added. 33 34 (WebKit::WebInspectorProxy::close): 35 Call didClose we can detach or close the window immediately instead of waiting for a 36 message from the WebProcess. 37 38 (WebKit::WebInspectorProxy::attach): 39 (WebKit::WebInspectorProxy::detach): 40 Check for !m_page to match other functions. 41 42 (WebKit::WebInspectorProxy::createInspectorPage): 43 (WebKit::WebInspectorProxy::didLoadInspectorPage): 44 Removed. Moved logic to open(). 45 46 (WebKit::WebInspectorProxy::open): Added. 47 48 (WebKit::WebInspectorProxy::didClose): 49 Clear new state booleans. Don't perform work again if already closed. Use platformDetach() 50 instead of detach() to avoid sending the SetAttachedWindow message. 51 52 (WebKit::WebInspectorProxy::bringToFront): 53 Call open() if we are not visible yet, otherwise platformBringToFront. 54 55 * UIProcess/WebInspectorProxy.h: 56 (WebKit::WebInspectorProxy::isConnected): Added. 57 58 * UIProcess/WebInspectorProxy.messages.in: Removed DidLoadInspectorPage. 59 60 * UIProcess/gtk/WebInspectorProxyGtk.cpp: 61 (WebKit::WebInspectorProxy::platformHide): Added stub. 62 63 * UIProcess/mac/WebInspectorProxyMac.mm: 64 (WebKit::WebInspectorProxy::platformHide): Added. 65 66 * UIProcess/qt/WebInspectorProxyQt.cpp: 67 (WebKit::WebInspectorProxy::platformHide): Added stub. 68 69 * WebProcess/WebCoreSupport/WebInspectorFrontendClient.cpp: 70 * WebProcess/WebCoreSupport/WebInspectorFrontendClient.h: 71 Removed frontendLoaded(). 72 73 * WebProcess/WebPage/WebInspector.cpp: 74 * WebProcess/WebPage/WebInspector.h: 75 Removed didLoadInspectorPage(). 76 1 77 2013-03-21 Alexey Proskuryakov <ap@apple.com> 2 78 -
trunk/Source/WebKit2/UIProcess/API/C/WKInspector.cpp
r137688 r146518 52 52 } 53 53 54 bool WKInspectorIsConnected(WKInspectorRef inspectorRef) 55 { 56 #if ENABLE(INSPECTOR) 57 return toImpl(inspectorRef)->isConnected(); 58 #else 59 UNUSED_PARAM(inspectorRef); 60 return false; 61 #endif 62 } 63 54 64 bool WKInspectorIsVisible(WKInspectorRef inspectorRef) 55 65 { … … 72 82 } 73 83 84 void WKInspectorConnect(WKInspectorRef inspectorRef) 85 { 86 #if ENABLE(INSPECTOR) 87 toImpl(inspectorRef)->connect(); 88 #else 89 UNUSED_PARAM(inspectorRef); 90 #endif 91 } 92 74 93 void WKInspectorShow(WKInspectorRef inspectorRef) 75 94 { … … 81 100 } 82 101 102 void WKInspectorHide(WKInspectorRef inspectorRef) 103 { 104 #if ENABLE(INSPECTOR) 105 toImpl(inspectorRef)->hide(); 106 #else 107 UNUSED_PARAM(inspectorRef); 108 #endif 109 } 110 83 111 void WKInspectorClose(WKInspectorRef inspectorRef) 84 112 { -
trunk/Source/WebKit2/UIProcess/API/C/WKInspector.h
r132875 r146518 41 41 WK_EXPORT WKPageRef WKInspectorGetPage(WKInspectorRef inspector); 42 42 43 WK_EXPORT bool WKInspectorIsConnected(WKInspectorRef inspector); 43 44 WK_EXPORT bool WKInspectorIsVisible(WKInspectorRef inspector); 44 45 WK_EXPORT bool WKInspectorIsFront(WKInspectorRef inspector); 46 47 WK_EXPORT void WKInspectorConnect(WKInspectorRef inspector); 48 45 49 WK_EXPORT void WKInspectorShow(WKInspectorRef inspector); 50 WK_EXPORT void WKInspectorHide(WKInspectorRef inspector); 46 51 WK_EXPORT void WKInspectorClose(WKInspectorRef inspector); 47 52 -
trunk/Source/WebKit2/UIProcess/WebInspectorProxy.cpp
r145963 r146518 89 89 , m_isProfilingJavaScript(false) 90 90 , m_isProfilingPage(false) 91 , m_showMessageSent(false) 92 , m_createdInspectorPage(false) 93 , m_ignoreFirstBringToFront(false) 91 94 #if PLATFORM(GTK) || PLATFORM(EFL) 92 95 , m_inspectorView(0) … … 114 117 115 118 m_page->close(); 119 116 120 didClose(); 117 121 118 122 m_page = 0; 119 120 m_isVisible = false;121 m_isDebuggingJavaScript = false;122 m_isProfilingJavaScript = false;123 m_isProfilingPage = false;124 123 } 125 124 … … 133 132 } 134 133 134 void WebInspectorProxy::connect() 135 { 136 if (!m_page) 137 return; 138 139 if (m_showMessageSent) 140 return; 141 142 m_showMessageSent = true; 143 m_ignoreFirstBringToFront = true; 144 145 m_page->process()->send(Messages::WebInspector::Show(), m_page->pageID()); 146 } 147 135 148 void WebInspectorProxy::show() 136 149 { … … 138 151 return; 139 152 140 m_page->process()->send(Messages::WebInspector::Show(), m_page->pageID()); 153 if (isConnected()) { 154 open(); 155 return; 156 } 157 158 connect(); 159 160 // Don't ignore the first bringToFront so it opens the Inspector. 161 m_ignoreFirstBringToFront = false; 162 } 163 164 void WebInspectorProxy::hide() 165 { 166 if (!m_page) 167 return; 168 169 m_isVisible = false; 170 171 platformHide(); 141 172 } 142 173 … … 147 178 148 179 m_page->process()->send(Messages::WebInspector::Close(), m_page->pageID()); 180 181 didClose(); 149 182 } 150 183 … … 169 202 if (!m_page) 170 203 return; 171 204 172 205 m_page->process()->send(Messages::WebInspector::ShowMainResourceForFrame(frame->frameID()), m_page->pageID()); 173 206 } … … 175 208 void WebInspectorProxy::attach() 176 209 { 177 if (! canAttach())210 if (!m_page || !canAttach()) 178 211 return; 179 212 … … 190 223 void WebInspectorProxy::detach() 191 224 { 225 if (!m_page) 226 return; 227 192 228 m_isAttached = false; 193 229 194 230 if (m_isVisible) 195 231 inspectorPageGroup()->preferences()->setInspectorStartsAttached(false); … … 342 378 343 379 inspectorPage->loadURL(url); 344 } 345 346 void WebInspectorProxy::didLoadInspectorPage() 347 { 380 381 m_createdInspectorPage = true; 382 } 383 384 void WebInspectorProxy::open() 385 { 386 ASSERT(m_createdInspectorPage); 387 348 388 m_isVisible = true; 349 389 350 // platformOpen is responsible for rendering attached mode depending on m_isAttached.351 390 platformOpen(); 352 391 } … … 354 393 void WebInspectorProxy::didClose() 355 394 { 395 if (!m_createdInspectorPage) 396 return; 397 356 398 m_isVisible = false; 357 399 m_isDebuggingJavaScript = false; 358 400 m_isProfilingJavaScript = false; 359 401 m_isProfilingPage = false; 360 361 if (m_isAttached) { 362 // Detach here so we only need to have one code path that is responsible for cleaning up the inspector 363 // state. 364 detach(); 402 m_createdInspectorPage = false; 403 m_showMessageSent = false; 404 m_ignoreFirstBringToFront = false; 405 406 if (m_isAttached) 407 platformDetach(); 408 m_isAttached = false; 409 410 platformDidClose(); 411 } 412 413 void WebInspectorProxy::bringToFront() 414 { 415 // WebCore::InspectorFrontendClientLocal tells us to do this on load. We want to 416 // ignore it once if we only wanted to connect. This allows the Inspector to later 417 // request to be brought to the front when a breakpoint is hit or some other action. 418 if (m_ignoreFirstBringToFront) { 419 m_ignoreFirstBringToFront = false; 420 return; 365 421 } 366 422 367 platformDidClose(); 368 } 369 370 void WebInspectorProxy::bringToFront() 371 { 372 platformBringToFront(); 423 if (m_isVisible) 424 platformBringToFront(); 425 else 426 open(); 373 427 } 374 428 -
trunk/Source/WebKit2/UIProcess/WebInspectorProxy.h
r145961 r146518 79 79 WebPageProxy* page() const { return m_page; } 80 80 81 bool isConnected() const { return m_createdInspectorPage; } 81 82 bool isVisible() const { return m_isVisible; } 82 83 bool isFront(); 83 84 85 void connect(); 86 84 87 void show(); 88 void hide(); 85 89 void close(); 86 90 … … 145 149 void platformDidClose(); 146 150 void platformBringToFront(); 151 void platformHide(); 147 152 bool platformIsFront(); 148 153 void platformAttachAvailabilityChanged(bool); … … 155 160 // Called by WebInspectorProxy messages 156 161 void createInspectorPage(uint64_t& inspectorPageID, WebPageCreationParameters&); 157 void didLoadInspectorPage();158 162 void didClose(); 159 163 void bringToFront(); … … 167 171 bool canAttach(); 168 172 bool shouldOpenAttached(); 173 174 void open(); 169 175 170 176 static WebPageGroup* inspectorPageGroup(); … … 190 196 bool m_isProfilingJavaScript; 191 197 bool m_isProfilingPage; 198 bool m_showMessageSent; 199 bool m_createdInspectorPage; 200 bool m_ignoreFirstBringToFront; 192 201 193 202 #if PLATFORM(MAC) -
trunk/Source/WebKit2/UIProcess/WebInspectorProxy.messages.in
r142160 r146518 25 25 messages -> WebInspectorProxy { 26 26 CreateInspectorPage() -> (uint64_t inspectorPageID, WebKit::WebPageCreationParameters inspectorPageParameters) 27 DidLoadInspectorPage()28 27 DidClose() 29 28 BringToFront() -
trunk/Source/WebKit2/UIProcess/efl/WebInspectorProxyEfl.cpp
r146265 r146518 143 143 } 144 144 145 void WebInspectorProxy::platformHide() 146 { 147 notImplemented(); 148 } 149 145 150 void WebInspectorProxy::platformBringToFront() 146 151 { -
trunk/Source/WebKit2/UIProcess/gtk/WebInspectorProxyGtk.cpp
r145951 r146518 126 126 } 127 127 128 void WebInspectorProxy::platformHide() 129 { 130 notImplemented(); 131 } 132 128 133 void WebInspectorProxy::platformBringToFront() 129 134 { -
trunk/Source/WebKit2/UIProcess/mac/WebInspectorProxyMac.mm
r145961 r146518 420 420 } 421 421 422 void WebInspectorProxy::platformHide() 423 { 424 if (m_isAttached) { 425 platformDetach(); 426 return; 427 } 428 429 if (m_inspectorWindow) { 430 [m_inspectorWindow.get() setDelegate:nil]; 431 [m_inspectorWindow.get() orderOut:nil]; 432 m_inspectorWindow = 0; 433 } 434 } 435 422 436 void WebInspectorProxy::platformBringToFront() 423 437 { -
trunk/Source/WebKit2/UIProcess/qt/WebInspectorProxyQt.cpp
r134346 r146518 46 46 47 47 void WebInspectorProxy::platformDidClose() 48 { 49 notImplemented(); 50 } 51 52 void WebInspectorProxy::platformHide() 48 53 { 49 54 notImplemented(); -
trunk/Source/WebKit2/WebProcess/WebCoreSupport/WebInspectorFrontendClient.cpp
r145717 r146518 46 46 } 47 47 48 void WebInspectorFrontendClient::frontendLoaded()49 {50 InspectorFrontendClientLocal::frontendLoaded();51 52 m_page->inspector()->didLoadInspectorPage();53 }54 55 48 String WebInspectorFrontendClient::localizedStringsURL() 56 49 { -
trunk/Source/WebKit2/WebProcess/WebCoreSupport/WebInspectorFrontendClient.h
r145717 r146518 40 40 41 41 private: 42 virtual void frontendLoaded() OVERRIDE;43 44 42 virtual String localizedStringsURL() OVERRIDE; 45 43 -
trunk/Source/WebKit2/WebProcess/WebPage/WebInspector.cpp
r140903 r146518 101 101 102 102 // Called from WebInspectorFrontendClient 103 void WebInspector::didLoadInspectorPage()104 {105 WebProcess::shared().connection()->send(Messages::WebInspectorProxy::DidLoadInspectorPage(), m_page->pageID());106 }107 108 103 void WebInspector::didClose() 109 104 { -
trunk/Source/WebKit2/WebProcess/WebPage/WebInspector.h
r141322 r146518 93 93 94 94 // Called from WebInspectorFrontendClient 95 void didLoadInspectorPage();96 95 void didClose(); 97 96 void bringToFront();
Note: See TracChangeset
for help on using the changeset viewer.