Chromium Code Reviews| Index: mash/catalog_viewer/catalog_viewer.cc |
| diff --git a/mash/catalog_viewer/catalog_viewer.cc b/mash/catalog_viewer/catalog_viewer.cc |
| index 0aa4a241fa477e579a2d1354207957f586a8b4c9..fcb162e321d18f8f4d2b2839be15c001d5e4bc85 100644 |
| --- a/mash/catalog_viewer/catalog_viewer.cc |
| +++ b/mash/catalog_viewer/catalog_viewer.cc |
| @@ -50,12 +50,12 @@ class CatalogViewerContents : public views::WidgetDelegateView, |
| table_view_parent_ = table_view_->CreateParentIfNecessary(); |
| AddChildView(table_view_parent_); |
| - catalog_->GetEntries(nullptr, |
| - base::Bind(&CatalogViewerContents::OnGotCatalogEntries, |
| - weak_ptr_factory_.GetWeakPtr())); |
| // We don't want to show an empty UI so we just block until we have all the |
| - // data. |
| - catalog_.WaitForIncomingResponse(); |
| + // data. GetEntries is a sync call. |
| + mojo::Array<catalog::mojom::EntryPtr> entries; |
| + catalog_->GetEntries(nullptr, &entries); |
| + |
| + OnGotCatalogEntries(entries); |
|
sky
2016/07/06 15:47:38
There is no point in OnGotCatalogEntries now. Move
yzshen1
2016/07/06 16:50:26
Not sure whether it matters, but please note that
leonhsl(Using Gerrit)
2016/07/07 07:43:12
Moved OnGotCatalogEntries() impl here.
leonhsl(Using Gerrit)
2016/07/07 07:43:12
Yeah this indeed becomes different with before.. T
|
| } |
| ~CatalogViewerContents() override { |
| table_view_->SetModel(nullptr); |
| @@ -117,7 +117,8 @@ class CatalogViewerContents : public views::WidgetDelegateView, |
| observer_ = observer; |
| } |
| - void OnGotCatalogEntries(mojo::Array<catalog::mojom::EntryPtr> entries) { |
| + void OnGotCatalogEntries( |
| + const mojo::Array<catalog::mojom::EntryPtr>& entries) { |
| entries_.clear(); |
| for (auto& entry : entries) |
| entries_.push_back(Entry(entry->display_name, entry->name)); |