| Index: components/html_viewer/html_document.cc
|
| diff --git a/components/html_viewer/html_document.cc b/components/html_viewer/html_document.cc
|
| index d7f287c45b8f009513fee39f4a1860eb5c124754..0b30e4a67721937d521e323cdc07d845e4b54ce7 100644
|
| --- a/components/html_viewer/html_document.cc
|
| +++ b/components/html_viewer/html_document.cc
|
| @@ -12,8 +12,10 @@
|
| #include "base/stl_util.h"
|
| #include "base/strings/string_util.h"
|
| #include "base/thread_task_runner_handle.h"
|
| +#include "components/devtools_service/public/cpp/switches.h"
|
| #include "components/html_viewer/blink_input_events_type_converters.h"
|
| #include "components/html_viewer/blink_url_request_type_converters.h"
|
| +#include "components/html_viewer/devtools_agent_impl.h"
|
| #include "components/html_viewer/media_factory.h"
|
| #include "components/html_viewer/setup.h"
|
| #include "components/html_viewer/web_layer_tree_view_impl.h"
|
| @@ -67,6 +69,11 @@ bool EnableOOPIFs() {
|
| return base::CommandLine::ForCurrentProcess()->HasSwitch(kOOPIF);
|
| }
|
|
|
| +bool EnableRemoteDebugging() {
|
| + return base::CommandLine::ForCurrentProcess()->HasSwitch(
|
| + devtools_service::kRemoteDebuggingPort);
|
| +}
|
| +
|
| // WebRemoteFrameClient implementation used for OOPIFs.
|
| // TODO(sky): this needs to talk to browser by way of an interface.
|
| class RemoteFrameClientImpl : public blink::WebRemoteFrameClient {
|
| @@ -214,8 +221,19 @@ void HTMLDocument::Load(URLResponsePtr response) {
|
| touch_handler_.reset(new TouchHandler(web_view_));
|
| web_layer_tree_view_impl_->set_widget(web_view_);
|
| ConfigureSettings(web_view_->settings());
|
| - web_view_->setMainFrame(
|
| - blink::WebLocalFrame::create(blink::WebTreeScopeType::Document, this));
|
| +
|
| + blink::WebLocalFrame* main_frame =
|
| + blink::WebLocalFrame::create(blink::WebTreeScopeType::Document, this);
|
| + web_view_->setMainFrame(main_frame);
|
| +
|
| + // TODO(yzshen): http://crbug.com/498986 Creating DevToolsAgentImpl instances
|
| + // causes html_viewer_apptests flakiness currently. Before we fix that we
|
| + // cannot enable remote debugging (which is required by Telemetry tests) on
|
| + // the bots.
|
| + if (EnableRemoteDebugging()) {
|
| + devtools_agent_.reset(
|
| + new DevToolsAgentImpl(main_frame, html_document_app_->shell()));
|
| + }
|
|
|
| GURL url(response->url);
|
|
|
| @@ -329,6 +347,9 @@ void HTMLDocument::frameDetached(blink::WebFrame* frame) {
|
| if (frame->parent())
|
| frame->parent()->removeChild(frame);
|
|
|
| + if (devtools_agent_ && frame == devtools_agent_->frame())
|
| + devtools_agent_.reset();
|
| +
|
| // |frame| is invalid after here.
|
| frame->close();
|
| }
|
|
|