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

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

Issue 2328463004: Implement WebGL's commit on the main thread (Closed)
Patch Set: update gpu pixel test expectation Created 4 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
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_frame_receiver_impl.h" 5 #include "content/browser/renderer_host/offscreen_canvas_frame_receiver_impl.h"
6 6
7 #include "cc/surfaces/surface.h" 7 #include "cc/surfaces/surface.h"
8 #include "cc/surfaces/surface_manager.h" 8 #include "cc/surfaces/surface_manager.h"
9 #include "content/browser/compositor/surface_utils.h" 9 #include "content/browser/compositor/surface_utils.h"
10 #include "mojo/public/cpp/bindings/strong_binding.h" 10 #include "mojo/public/cpp/bindings/strong_binding.h"
(...skipping 15 matching lines...) Expand all
26 } 26 }
27 } 27 }
28 28
29 // static 29 // static
30 void OffscreenCanvasFrameReceiverImpl::Create( 30 void OffscreenCanvasFrameReceiverImpl::Create(
31 blink::mojom::OffscreenCanvasFrameReceiverRequest request) { 31 blink::mojom::OffscreenCanvasFrameReceiverRequest request) {
32 mojo::MakeStrongBinding(base::MakeUnique<OffscreenCanvasFrameReceiverImpl>(), 32 mojo::MakeStrongBinding(base::MakeUnique<OffscreenCanvasFrameReceiverImpl>(),
33 std::move(request)); 33 std::move(request));
34 } 34 }
35 35
36 void OffscreenCanvasFrameReceiverImpl::SetClient(
37 blink::mojom::OffscreenCanvasFrameReceiverClientPtr client) {
38 DCHECK(!client_.get());
dcheng 2016/09/14 20:02:19 Nit: the .get() should be unnecessary
39 client_ = std::move(client);
40 }
41
36 void OffscreenCanvasFrameReceiverImpl::SubmitCompositorFrame( 42 void OffscreenCanvasFrameReceiverImpl::SubmitCompositorFrame(
37 const cc::SurfaceId& surface_id, 43 const cc::SurfaceId& surface_id,
38 cc::CompositorFrame frame) { 44 cc::CompositorFrame frame) {
39 if (!surface_factory_) { 45 if (!surface_factory_) {
40 cc::SurfaceManager* manager = GetSurfaceManager(); 46 cc::SurfaceManager* manager = GetSurfaceManager();
41 surface_factory_ = base::MakeUnique<cc::SurfaceFactory>(manager, this); 47 surface_factory_ = base::MakeUnique<cc::SurfaceFactory>(manager, this);
42 surface_factory_->Create(surface_id); 48 surface_factory_->Create(surface_id);
43 49
44 GetSurfaceManager()->RegisterSurfaceClientId(surface_id.client_id()); 50 GetSurfaceManager()->RegisterSurfaceClientId(surface_id.client_id());
45 } 51 }
46 if (surface_id_.is_null()) { 52 if (surface_id_.is_null()) {
47 surface_id_ = surface_id; 53 surface_id_ = surface_id;
48 } 54 }
49 surface_factory_->SubmitCompositorFrame(surface_id, std::move(frame), 55 surface_factory_->SubmitCompositorFrame(surface_id, std::move(frame),
50 base::Closure()); 56 base::Closure());
51 } 57 }
52 58
53 // TODO(619136): Implement cc::SurfaceFactoryClient functions for resources 59 // TODO(619136): Implement cc::SurfaceFactoryClient functions for resources
54 // return. 60 // return.
55 void OffscreenCanvasFrameReceiverImpl::ReturnResources( 61 void OffscreenCanvasFrameReceiverImpl::ReturnResources(
56 const cc::ReturnedResourceArray& resources) {} 62 const cc::ReturnedResourceArray& resources) {
63 client_->ReturnResources(resources);
64 }
57 65
58 void OffscreenCanvasFrameReceiverImpl::WillDrawSurface( 66 void OffscreenCanvasFrameReceiverImpl::WillDrawSurface(
59 const cc::SurfaceId& id, 67 const cc::SurfaceId& id,
60 const gfx::Rect& damage_rect) {} 68 const gfx::Rect& damage_rect) {}
61 69
62 void OffscreenCanvasFrameReceiverImpl::SetBeginFrameSource( 70 void OffscreenCanvasFrameReceiverImpl::SetBeginFrameSource(
63 cc::BeginFrameSource* begin_frame_source) {} 71 cc::BeginFrameSource* begin_frame_source) {}
64 72
65 } // namespace content 73 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698