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

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

Issue 2610723002: Unify SurfaceInfo (Closed)
Patch Set: More cleanup 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.id(),
57 frame_size.height(), device_scale_factor); 55 surface_info.size_in_pixels().width(),
56 surface_info.size_in_pixels().height(),
57 surface_info.device_scale_factor());
58 } 58 }
59 } 59 }
60 } 60 }
61 61
62 void OffscreenCanvasSurfaceImpl::Require(const cc::SurfaceId& surface_id, 62 void OffscreenCanvasSurfaceImpl::Require(const cc::SurfaceId& surface_id,
63 const cc::SurfaceSequence& sequence) { 63 const cc::SurfaceSequence& sequence) {
64 cc::SurfaceManager* manager = GetSurfaceManager(); 64 cc::SurfaceManager* manager = GetSurfaceManager();
65 cc::Surface* surface = manager->GetSurfaceForId(surface_id); 65 cc::Surface* surface = manager->GetSurfaceForId(surface_id);
66 if (!surface) { 66 if (!surface) {
67 DLOG(ERROR) << "Attempting to require callback on nonexistent surface"; 67 DLOG(ERROR) << "Attempting to require callback on nonexistent surface";
68 return; 68 return;
69 } 69 }
70 surface->AddDestructionDependency(sequence); 70 surface->AddDestructionDependency(sequence);
71 } 71 }
72 72
73 void OffscreenCanvasSurfaceImpl::Satisfy(const cc::SurfaceSequence& sequence) { 73 void OffscreenCanvasSurfaceImpl::Satisfy(const cc::SurfaceSequence& sequence) {
74 std::vector<uint32_t> sequences; 74 std::vector<uint32_t> sequences;
75 sequences.push_back(sequence.sequence); 75 sequences.push_back(sequence.sequence);
76 cc::SurfaceManager* manager = GetSurfaceManager(); 76 cc::SurfaceManager* manager = GetSurfaceManager();
77 manager->DidSatisfySequences(sequence.frame_sink_id, &sequences); 77 manager->DidSatisfySequences(sequence.frame_sink_id, &sequences);
78 } 78 }
79 79
80 } // namespace content 80 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698