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

Side by Side Diff: content/browser/renderer_host/offscreen_canvas_surface_impl.cc

Issue 2610723002: Unify SurfaceInfo (Closed)
Patch Set: Cleanup offscreen canvas Created 3 years, 11 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
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 "content/browser/renderer_host/offscreen_canvas_surface_impl.h" 5 #include "content/browser/renderer_host/offscreen_canvas_surface_impl.h"
6 6
7 #include <utility> 7 #include <utility>
8 8
9 #include "base/bind_helpers.h" 9 #include "base/bind_helpers.h"
10 #include "base/memory/ptr_util.h" 10 #include "base/memory/ptr_util.h"
(...skipping 27 matching lines...) Expand all
38 blink::mojom::OffscreenCanvasSurfaceRequest request) { 38 blink::mojom::OffscreenCanvasSurfaceRequest request) {
39 std::unique_ptr<OffscreenCanvasSurfaceImpl> impl = 39 std::unique_ptr<OffscreenCanvasSurfaceImpl> impl =
40 base::MakeUnique<OffscreenCanvasSurfaceImpl>(frame_sink_id, 40 base::MakeUnique<OffscreenCanvasSurfaceImpl>(frame_sink_id,
41 std::move(client)); 41 std::move(client));
42 OffscreenCanvasSurfaceImpl* surface_service = impl.get(); 42 OffscreenCanvasSurfaceImpl* surface_service = impl.get();
43 surface_service->binding_ = 43 surface_service->binding_ =
44 mojo::MakeStrongBinding(std::move(impl), std::move(request)); 44 mojo::MakeStrongBinding(std::move(impl), std::move(request));
45 } 45 }
46 46
47 void OffscreenCanvasSurfaceImpl::OnSurfaceCreated( 47 void OffscreenCanvasSurfaceImpl::OnSurfaceCreated(
48 const cc::SurfaceId& surface_id, 48 const cc::SurfaceInfo& surface_info) {
49 const gfx::Size& frame_size, 49 DCHECK_EQ(surface_info.id().frame_sink_id(), frame_sink_id_);
50 float device_scale_factor) {
51 DCHECK_EQ(surface_id.frame_sink_id(), frame_sink_id_);
52 if (!current_local_frame_id_.is_valid() || 50 if (!current_local_frame_id_.is_valid() ||
53 surface_id.local_frame_id() != current_local_frame_id_) { 51 surface_info.id().local_frame_id() != current_local_frame_id_) {
54 current_local_frame_id_ = surface_id.local_frame_id(); 52 current_local_frame_id_ = surface_info.id().local_frame_id();
55 if (client_) { 53 if (client_)
56 client_->OnSurfaceCreated(surface_id, frame_size.width(), 54 client_->OnSurfaceCreated(surface_info);
57 frame_size.height(), device_scale_factor);
58 }
59 } 55 }
60 } 56 }
61 57
62 void OffscreenCanvasSurfaceImpl::Require(const cc::SurfaceId& surface_id, 58 void OffscreenCanvasSurfaceImpl::Require(const cc::SurfaceId& surface_id,
63 const cc::SurfaceSequence& sequence) { 59 const cc::SurfaceSequence& sequence) {
64 cc::SurfaceManager* manager = GetSurfaceManager(); 60 cc::SurfaceManager* manager = GetSurfaceManager();
65 cc::Surface* surface = manager->GetSurfaceForId(surface_id); 61 cc::Surface* surface = manager->GetSurfaceForId(surface_id);
66 if (!surface) { 62 if (!surface) {
67 DLOG(ERROR) << "Attempting to require callback on nonexistent surface"; 63 DLOG(ERROR) << "Attempting to require callback on nonexistent surface";
68 return; 64 return;
69 } 65 }
70 surface->AddDestructionDependency(sequence); 66 surface->AddDestructionDependency(sequence);
71 } 67 }
72 68
73 void OffscreenCanvasSurfaceImpl::Satisfy(const cc::SurfaceSequence& sequence) { 69 void OffscreenCanvasSurfaceImpl::Satisfy(const cc::SurfaceSequence& sequence) {
74 std::vector<uint32_t> sequences; 70 std::vector<uint32_t> sequences;
75 sequences.push_back(sequence.sequence); 71 sequences.push_back(sequence.sequence);
76 cc::SurfaceManager* manager = GetSurfaceManager(); 72 cc::SurfaceManager* manager = GetSurfaceManager();
77 manager->DidSatisfySequences(sequence.frame_sink_id, &sequences); 73 manager->DidSatisfySequences(sequence.frame_sink_id, &sequences);
78 } 74 }
79 75
80 } // namespace content 76 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698