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

Side by Side Diff: blimp/client/core/render_widget/blimp_document_manager.cc

Issue 2459823003: blimp: Use SwapPromises for readback API. (Closed)
Patch Set: comment updated Created 4 years, 1 month 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 unified diff | Download patch
« no previous file with comments | « blimp/client/core/render_widget/blimp_document_manager.h ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2016 The Chromium Authors. All rights reserved. 1 // Copyright 2016 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "blimp/client/core/render_widget/blimp_document_manager.h" 5 #include "blimp/client/core/render_widget/blimp_document_manager.h"
6 6
7 #include "base/memory/ptr_util.h" 7 #include "base/memory/ptr_util.h"
8 #include "blimp/client/core/compositor/blimp_compositor_dependencies.h" 8 #include "blimp/client/core/compositor/blimp_compositor_dependencies.h"
9 #include "blimp/client/core/render_widget/blimp_document.h" 9 #include "blimp/client/core/render_widget/blimp_document.h"
10 #include "cc/output/copy_output_request.h"
10 #include "cc/proto/compositor_message.pb.h" 11 #include "cc/proto/compositor_message.pb.h"
11 12
12 namespace blimp { 13 namespace blimp {
13 namespace client { 14 namespace client {
14 15
15 BlimpDocumentManager::BlimpDocumentManager( 16 BlimpDocumentManager::BlimpDocumentManager(
16 int blimp_contents_id, 17 int blimp_contents_id,
17 RenderWidgetFeature* render_widget_feature, 18 RenderWidgetFeature* render_widget_feature,
18 BlimpCompositorDependencies* compositor_dependencies) 19 BlimpCompositorDependencies* compositor_dependencies)
19 : blimp_contents_id_(blimp_contents_id), 20 : blimp_contents_id_(blimp_contents_id),
(...skipping 17 matching lines...) Expand all
37 if (active_document_) 38 if (active_document_)
38 active_document_->GetCompositor()->SetVisible(visible_); 39 active_document_->GetCompositor()->SetVisible(visible_);
39 } 40 }
40 41
41 bool BlimpDocumentManager::OnTouchEvent(const ui::MotionEvent& motion_event) { 42 bool BlimpDocumentManager::OnTouchEvent(const ui::MotionEvent& motion_event) {
42 if (active_document_) 43 if (active_document_)
43 return active_document_->OnTouchEvent(motion_event); 44 return active_document_->OnTouchEvent(motion_event);
44 return false; 45 return false;
45 } 46 }
46 47
47 void BlimpDocumentManager::NotifyWhenDonePendingCommits( 48 void BlimpDocumentManager::RequestCopyOfCompositorOutput(
48 base::Closure callback) { 49 std::unique_ptr<cc::CopyOutputRequest> copy_request,
49 if (!active_document_ || !visible_) { 50 bool flush_pending_update) {
50 callback.Run(); 51 if (!active_document_)
51 return; 52 return;
52 }
53 53
54 active_document_->GetCompositor()->NotifyWhenDonePendingCommits(callback); 54 active_document_->GetCompositor()->RequestCopyOfOutput(
55 std::move(copy_request), flush_pending_update);
55 } 56 }
56 57
57 std::unique_ptr<BlimpDocument> BlimpDocumentManager::CreateBlimpDocument( 58 std::unique_ptr<BlimpDocument> BlimpDocumentManager::CreateBlimpDocument(
58 int document_id, 59 int document_id,
59 BlimpCompositorDependencies* compositor_dependencies) { 60 BlimpCompositorDependencies* compositor_dependencies) {
60 return base::MakeUnique<BlimpDocument>(document_id, compositor_dependencies, 61 return base::MakeUnique<BlimpDocument>(document_id, compositor_dependencies,
61 this); 62 this);
62 } 63 }
63 64
64 void BlimpDocumentManager::OnRenderWidgetCreated(int render_widget_id) { 65 void BlimpDocumentManager::OnRenderWidgetCreated(int render_widget_id) {
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after
127 128
128 BlimpDocument* BlimpDocumentManager::GetDocument(int document_id) { 129 BlimpDocument* BlimpDocumentManager::GetDocument(int document_id) {
129 DocumentMap::const_iterator it = documents_.find(document_id); 130 DocumentMap::const_iterator it = documents_.find(document_id);
130 if (it == documents_.end()) 131 if (it == documents_.end())
131 return nullptr; 132 return nullptr;
132 return it->second.get(); 133 return it->second.get();
133 } 134 }
134 135
135 } // namespace client 136 } // namespace client
136 } // namespace blimp 137 } // namespace blimp
OLDNEW
« no previous file with comments | « blimp/client/core/render_widget/blimp_document_manager.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698