| OLD | NEW |
| 1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "config.h" | 5 #include "config.h" |
| 6 | 6 |
| 7 #include "Frame.h" | 7 #include "Frame.h" |
| 8 #include "PageGroupLoadDeferrer.h" | 8 #include "PageGroupLoadDeferrer.h" |
| 9 #include "V8Proxy.h" | 9 #include "V8Proxy.h" |
| 10 #include <wtf/HashSet.h> | 10 #include <wtf/HashSet.h> |
| 11 #undef LOG | 11 #undef LOG |
| 12 | 12 |
| 13 #include "webkit/api/public/WebDevToolsAgent.h" | 13 #include "webkit/api/public/WebDevToolsAgent.h" |
| 14 #include "webkit/api/src/WebFrameImpl.h" |
| 15 #include "webkit/api/src/WebViewImpl.h" |
| 14 #include "webkit/glue/devtools/debugger_agent_impl.h" | 16 #include "webkit/glue/devtools/debugger_agent_impl.h" |
| 15 #include "webkit/glue/devtools/debugger_agent_manager.h" | 17 #include "webkit/glue/devtools/debugger_agent_manager.h" |
| 16 #include "webkit/glue/webdevtoolsagent_impl.h" | 18 #include "webkit/glue/webdevtoolsagent_impl.h" |
| 17 #include "webkit/glue/webview_impl.h" | |
| 18 | 19 |
| 19 #if USE(V8) | 20 #if USE(V8) |
| 20 #include "v8/include/v8-debug.h" | 21 #include "v8/include/v8-debug.h" |
| 21 #endif | 22 #endif |
| 22 | 23 |
| 23 using WebKit::WebDevToolsAgent; | 24 using WebKit::WebDevToolsAgent; |
| 25 using WebKit::WebFrameImpl; |
| 26 using WebKit::WebViewImpl; |
| 24 | 27 |
| 25 WebDevToolsAgent::MessageLoopDispatchHandler | 28 WebDevToolsAgent::MessageLoopDispatchHandler |
| 26 DebuggerAgentManager::message_loop_dispatch_handler_ = NULL; | 29 DebuggerAgentManager::message_loop_dispatch_handler_ = NULL; |
| 27 | 30 |
| 28 // static | 31 // static |
| 29 bool DebuggerAgentManager::in_host_dispatch_handler_ = false; | 32 bool DebuggerAgentManager::in_host_dispatch_handler_ = false; |
| 30 | 33 |
| 31 // static | 34 // static |
| 32 DebuggerAgentManager::DeferrersMap DebuggerAgentManager::page_deferrers_; | 35 DebuggerAgentManager::DeferrersMap DebuggerAgentManager::page_deferrers_; |
| 33 | 36 |
| (...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 70 Vector<WebViewImpl*> views; | 73 Vector<WebViewImpl*> views; |
| 71 // 1. Disable active objects and input events. | 74 // 1. Disable active objects and input events. |
| 72 for (AttachedAgentsMap::iterator it = attached_agents_map_->begin(); | 75 for (AttachedAgentsMap::iterator it = attached_agents_map_->begin(); |
| 73 it != attached_agents_map_->end(); | 76 it != attached_agents_map_->end(); |
| 74 ++it) { | 77 ++it) { |
| 75 DebuggerAgentImpl* agent = it->second; | 78 DebuggerAgentImpl* agent = it->second; |
| 76 page_deferrers_.set( | 79 page_deferrers_.set( |
| 77 agent->web_view(), | 80 agent->web_view(), |
| 78 new WebCore::PageGroupLoadDeferrer(agent->GetPage(), true)); | 81 new WebCore::PageGroupLoadDeferrer(agent->GetPage(), true)); |
| 79 views.append(agent->web_view()); | 82 views.append(agent->web_view()); |
| 80 agent->web_view()->SetIgnoreInputEvents(true); | 83 agent->web_view()->setIgnoreInputEvents(true); |
| 81 } | 84 } |
| 82 | 85 |
| 83 // 2. Process messages. | 86 // 2. Process messages. |
| 84 DebuggerAgentManager::message_loop_dispatch_handler_(); | 87 DebuggerAgentManager::message_loop_dispatch_handler_(); |
| 85 | 88 |
| 86 // 3. Bring things back. | 89 // 3. Bring things back. |
| 87 for (Vector<WebViewImpl*>::iterator it = views.begin(); | 90 for (Vector<WebViewImpl*>::iterator it = views.begin(); |
| 88 it != views.end(); | 91 it != views.end(); |
| 89 ++it) { | 92 ++it) { |
| 90 if (page_deferrers_.contains(*it)) { | 93 if (page_deferrers_.contains(*it)) { |
| 91 // The view was not closed during the dispatch. | 94 // The view was not closed during the dispatch. |
| 92 (*it)->SetIgnoreInputEvents(false); | 95 (*it)->setIgnoreInputEvents(false); |
| 93 } | 96 } |
| 94 } | 97 } |
| 95 deleteAllValues(page_deferrers_); | 98 deleteAllValues(page_deferrers_); |
| 96 page_deferrers_.clear(); | 99 page_deferrers_.clear(); |
| 97 | 100 |
| 98 in_host_dispatch_handler_ = false; | 101 in_host_dispatch_handler_ = false; |
| 99 if (!attached_agents_map_) { | 102 if (!attached_agents_map_) { |
| 100 // Remove handlers if all agents were detached within host dispatch. | 103 // Remove handlers if all agents were detached within host dispatch. |
| 101 v8::Debug::SetMessageHandler(NULL); | 104 v8::Debug::SetMessageHandler(NULL); |
| 102 v8::Debug::SetHostDispatchHandler(NULL); | 105 v8::Debug::SetHostDispatchHandler(NULL); |
| (...skipping 209 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 312 return NULL; | 315 return NULL; |
| 313 } | 316 } |
| 314 | 317 |
| 315 // static | 318 // static |
| 316 DebuggerAgentImpl* DebuggerAgentManager::DebuggerAgentForHostId(int host_id) { | 319 DebuggerAgentImpl* DebuggerAgentManager::DebuggerAgentForHostId(int host_id) { |
| 317 if (!attached_agents_map_) { | 320 if (!attached_agents_map_) { |
| 318 return NULL; | 321 return NULL; |
| 319 } | 322 } |
| 320 return attached_agents_map_->get(host_id); | 323 return attached_agents_map_->get(host_id); |
| 321 } | 324 } |
| OLD | NEW |