Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(641)

Unified Diff: sky/viewer/internals.cc

Issue 858103002: Remove [Client=] annotation from ServiceProvider (Closed) Base URL: git@github.com:domokit/mojo.git@master
Patch Set: Created 5 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: sky/viewer/internals.cc
diff --git a/sky/viewer/internals.cc b/sky/viewer/internals.cc
index 5edf79affc691598f4274f8550c0ada50d0d28a1..fee5d0babe4e76d04c120822ffdcd32e507e3207 100644
--- a/sky/viewer/internals.cc
+++ b/sky/viewer/internals.cc
@@ -39,7 +39,6 @@ gin::Handle<Internals> Internals::Create(
Internals::Internals(DocumentView* document_view)
: document_view_(document_view->GetWeakPtr()),
shell_binding_(this) {
- mojo::ConnectToService(document_view->imported_services(), &test_harness_);
}
Internals::~Internals() {
@@ -72,15 +71,18 @@ std::string Internals::ContentAsText() {
}
void Internals::NotifyTestComplete(const std::string& test_result) {
+ if (!document_view_->imported_services())
+ return; // Can't call NotifyTestComplete without a test_harness_ impl.
std::vector<unsigned char> pixels;
document_view_->GetPixelsForTesting(&pixels);
+ mojo::ConnectToService(document_view_->imported_services(), &test_harness_);
test_harness_->OnTestComplete(test_result,
mojo::Array<uint8_t>::From(pixels));
}
mojo::Handle Internals::ConnectToEmbedderService(
const std::string& interface_name) {
- if (!document_view_)
+ if (!document_view_ || !document_view_->imported_services())
return mojo::Handle();
mojo::MessagePipe pipe;

Powered by Google App Engine
This is Rietveld 408576698