Chromium Code Reviews| Index: ui/snapshot/snapshot_aura.cc |
| diff --git a/ui/snapshot/snapshot_aura.cc b/ui/snapshot/snapshot_aura.cc |
| index 44b136eb6fd61a59b22ce9aec01a51104f97c19b..4a136c84f0e0ea0802ec9768c9cbee3a0b7c9d54 100644 |
| --- a/ui/snapshot/snapshot_aura.cc |
| +++ b/ui/snapshot/snapshot_aura.cc |
| @@ -29,13 +29,13 @@ bool GrabWindowSnapshotAura(aura::Window* window, |
| } |
| static void MakeAsyncCopyRequest( |
| - aura::Window* window, |
| + Layer* layer, |
| const gfx::Rect& source_rect, |
| const cc::CopyOutputRequest::CopyOutputRequestCallback& callback) { |
| std::unique_ptr<cc::CopyOutputRequest> request = |
| cc::CopyOutputRequest::CreateBitmapRequest(callback); |
| request->set_area(source_rect); |
| - window->layer()->RequestCopyOfOutput(std::move(request)); |
| + layer->RequestCopyOfOutput(std::move(request)); |
| } |
| static void FinishedAsyncCopyRequest( |
| @@ -55,7 +55,7 @@ static void FinishedAsyncCopyRequest( |
| // dereference. |
| aura::Window* window = tracker->windows()[0]; |
| MakeAsyncCopyRequest( |
| - window, source_rect, |
| + window->layer(), source_rect, |
| base::Bind(&FinishedAsyncCopyRequest, base::Passed(&tracker), |
| source_rect, callback, retry_count + 1)); |
| return; |
| @@ -71,7 +71,7 @@ static void MakeInitialAsyncCopyRequest( |
| auto tracker = base::MakeUnique<aura::WindowTracker>(); |
| tracker->Add(window); |
| MakeAsyncCopyRequest( |
| - window, source_rect, |
| + window->layer(), source_rect, |
| base::Bind(&FinishedAsyncCopyRequest, base::Passed(&tracker), source_rect, |
| callback, 0)); |
| } |
| @@ -133,6 +133,14 @@ void GrabViewSnapshotAsync(gfx::NativeView view, |
| GrabWindowSnapshotAsyncAura(view, source_rect, callback); |
| } |
| +void GrabLayerSnapshotAsync(ui::Layer* layer, |
|
sky
2017/05/17 14:48:30
How come this doesn't need the logic in FinishedAs
Muyuan
2017/05/17 19:25:35
A window tracker used in FinishedAsyncCopyRequest
|
| + const gfx::Rect& source_rect, |
| + const GrabLayerSnapshotCallback& callback) { |
| + MakeAsyncCopyRequest( |
| + layer, source_rect, |
| + base::Bind(&SnapshotAsync::RunCallbackWithCopyOutputResult, callback)); |
| +} |
| + |
| #endif |
| } // namespace ui |