mirror of
https://github.com/flutter/flutter.git
synced 2026-02-20 02:29:02 +08:00
In preperation for removing the Client annotation from ServiceProvider this passes a second parameter of type ServiceProvider in the shell and application Connect calls. In this patch the type signatures are updated but the second parameter is basically unused. The intention is that the first parameter |services| will be used for the connecting application to request services from the connected application (as it does currently) and the second parameter |exported_services| be used for the connecting application to provide services to the connected application. We have very few services exported in the second direction today - I'll update them to use the second parameter in a follow-up patch. R=darin@chromium.org Review URL: https://codereview.chromium.org/845593003
45 lines
1.4 KiB
C++
45 lines
1.4 KiB
C++
// Copyright 2014 The Chromium Authors. All rights reserved.
|
|
// Use of this source code is governed by a BSD-style license that can be
|
|
// found in the LICENSE file.
|
|
|
|
#include "sky/viewer/services/inspector_impl.h"
|
|
|
|
#include "base/bind.h"
|
|
#include "sky/engine/public/web/WebDocument.h"
|
|
#include "sky/engine/public/web/WebElement.h"
|
|
#include "sky/engine/public/web/WebFrame.h"
|
|
#include "sky/engine/public/web/WebView.h"
|
|
#include "sky/services/inspector/inspector.mojom.h"
|
|
#include "sky/viewer/document_view.h"
|
|
|
|
namespace sky {
|
|
|
|
InspectorServiceImpl::InspectorServiceImpl(DocumentView* view)
|
|
: view_(view->GetWeakPtr()) {
|
|
}
|
|
|
|
InspectorServiceImpl::~InspectorServiceImpl() {
|
|
}
|
|
|
|
void Ignored() {}
|
|
|
|
void InspectorServiceImpl::Inject() {
|
|
if (!view_)
|
|
return;
|
|
|
|
mojo::ServiceProviderPtr inspector_service_provider;
|
|
view_->shell()->ConnectToApplication("mojo:sky_inspector_server",
|
|
GetProxy(&inspector_service_provider),
|
|
nullptr);
|
|
InspectorServerPtr inspector;
|
|
mojo::ConnectToService(inspector_service_provider.get(), &inspector);
|
|
inspector->Listen(9898, base::Bind(&Ignored));
|
|
// Listen drops existing agents/backends, wait before registering new ones.
|
|
inspector.WaitForIncomingMethodCall();
|
|
|
|
view_->web_view()->injectModule("/sky/framework/inspector/inspector.sky");
|
|
view_->StartDebuggerInspectorBackend();
|
|
}
|
|
|
|
} // namespace sky
|