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

Side by Side Diff: cc/surfaces/surface.cc

Issue 509193002: Allow requesting a copy of a surface. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years, 3 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 unified diff | Download patch
« no previous file with comments | « cc/surfaces/surface.h ('k') | cc/surfaces/surface_factory.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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 "cc/surfaces/surface.h" 5 #include "cc/surfaces/surface.h"
6 6
7 #include "cc/output/compositor_frame.h" 7 #include "cc/output/compositor_frame.h"
8 #include "cc/output/copy_output_request.h"
8 #include "cc/surfaces/surface_factory.h" 9 #include "cc/surfaces/surface_factory.h"
9 10
10 namespace cc { 11 namespace cc {
11 12
12 // The frame index starts at 2 so that empty frames will be treated as 13 // The frame index starts at 2 so that empty frames will be treated as
13 // completely damaged the first time they're drawn from. 14 // completely damaged the first time they're drawn from.
14 static const int kFrameIndexStart = 2; 15 static const int kFrameIndexStart = 2;
15 16
16 Surface::Surface(SurfaceId id, const gfx::Size& size, SurfaceFactory* factory) 17 Surface::Surface(SurfaceId id, const gfx::Size& size, SurfaceFactory* factory)
17 : surface_id_(id), 18 : surface_id_(id),
(...skipping 25 matching lines...) Expand all
43 TransferableResource::ReturnResources( 44 TransferableResource::ReturnResources(
44 previous_frame->delegated_frame_data->resource_list, 45 previous_frame->delegated_frame_data->resource_list,
45 &previous_resources); 46 &previous_resources);
46 factory_->UnrefResources(previous_resources); 47 factory_->UnrefResources(previous_resources);
47 } 48 }
48 if (!draw_callback_.is_null()) 49 if (!draw_callback_.is_null())
49 draw_callback_.Run(); 50 draw_callback_.Run();
50 draw_callback_ = callback; 51 draw_callback_ = callback;
51 } 52 }
52 53
54 void Surface::RequestCopyOfOutput(scoped_ptr<CopyOutputRequest> copy_request) {
55 // TODO(jbauman): Make this work.
56 copy_request->SendEmptyResult();
57 }
58
53 const CompositorFrame* Surface::GetEligibleFrame() { 59 const CompositorFrame* Surface::GetEligibleFrame() {
54 return current_frame_.get(); 60 return current_frame_.get();
55 } 61 }
56 62
57 void Surface::RunDrawCallbacks() { 63 void Surface::RunDrawCallbacks() {
58 if (!draw_callback_.is_null()) { 64 if (!draw_callback_.is_null()) {
59 base::Closure callback = draw_callback_; 65 base::Closure callback = draw_callback_;
60 draw_callback_ = base::Closure(); 66 draw_callback_ = base::Closure();
61 callback.Run(); 67 callback.Run();
62 } 68 }
63 } 69 }
64 70
65 } // namespace cc 71 } // namespace cc
OLDNEW
« no previous file with comments | « cc/surfaces/surface.h ('k') | cc/surfaces/surface_factory.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698