Skip to content

Commit

Permalink
Fix sky_viewer when being run from a skyx snapshot.
Browse files Browse the repository at this point in the history
  • Loading branch information
alhaad committed Aug 26, 2015
1 parent 82bf8bc commit d63163d
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 2 deletions.
8 changes: 6 additions & 2 deletions services/sky/document_view.cc
Original file line number Diff line number Diff line change
Expand Up @@ -130,9 +130,10 @@ void DocumentView::OnEmbed(
services_provided_by_embedder_ = services_provided_by_embedder.Pass();

Load(response_.Pass());
}

void DocumentView::UpdateRootMetricsAndAddObserver() {
UpdateRootSizeAndViewportMetrics(root_->bounds());

root_->AddObserver(this);
}

Expand All @@ -142,8 +143,10 @@ void DocumentView::OnViewManagerDisconnected(mojo::ViewManager* view_manager) {

void DocumentView::LoadFromSnapshotStream(
String name, mojo::ScopedDataPipeConsumerHandle snapshot) {
if (sky_view_)
if (sky_view_) {
sky_view_->RunFromSnapshot(name, snapshot.Pass());
UpdateRootMetricsAndAddObserver();
}
}

void DocumentView::Load(mojo::URLResponsePtr response) {
Expand All @@ -168,6 +171,7 @@ void DocumentView::Load(mojo::URLResponsePtr response) {
network_service_.get(),
CreatePrefetchedLibraryIfNeeded(name, response.Pass())));
sky_view_->RunFromLibrary(name, library_provider_.get());
UpdateRootMetricsAndAddObserver();
}

scoped_ptr<Rasterizer> DocumentView::CreateRasterizer() {
Expand Down
2 changes: 2 additions & 0 deletions services/sky/document_view.h
Original file line number Diff line number Diff line change
Expand Up @@ -109,6 +109,8 @@ class DocumentView : public blink::ServiceProvider,
void LoadFromSnapshotStream(String name,
mojo::ScopedDataPipeConsumerHandle snapshot);

void UpdateRootMetricsAndAddObserver();

void UpdateRootSizeAndViewportMetrics(const mojo::Rect& new_bounds);

void InitServiceRegistry();
Expand Down

0 comments on commit d63163d

Please sign in to comment.