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

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

Issue 2087383002: Fix destruction order between SurfaceManger and OffscreenCanvasSurfaceImpl (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 6 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 "base/bind_helpers.h" 7 #include "base/bind_helpers.h"
8 #include "cc/surfaces/surface.h" 8 #include "cc/surfaces/surface.h"
9 #include "cc/surfaces/surface_manager.h" 9 #include "cc/surfaces/surface_manager.h"
10 #include "content/browser/compositor/surface_utils.h" 10 #include "content/browser/compositor/surface_utils.h"
11 #include "content/public/browser/browser_thread.h" 11 #include "content/public/browser/browser_thread.h"
12 #include <iostream>
12 13
13 namespace content { 14 namespace content {
14 15
15 // static 16 // static
16 void OffscreenCanvasSurfaceImpl::Create( 17 void OffscreenCanvasSurfaceImpl::Create(
17 mojo::InterfaceRequest<blink::mojom::OffscreenCanvasSurface> request) { 18 mojo::InterfaceRequest<blink::mojom::OffscreenCanvasSurface> request) {
18 // |binding_| will take ownership of OffscreenCanvasSurfaceImpl 19 // |binding_| will take ownership of OffscreenCanvasSurfaceImpl
19 new OffscreenCanvasSurfaceImpl(std::move(request)); 20 new OffscreenCanvasSurfaceImpl(std::move(request));
20 } 21 }
21 22
22 OffscreenCanvasSurfaceImpl::OffscreenCanvasSurfaceImpl( 23 OffscreenCanvasSurfaceImpl::OffscreenCanvasSurfaceImpl(
23 mojo::InterfaceRequest<blink::mojom::OffscreenCanvasSurface> request) 24 mojo::InterfaceRequest<blink::mojom::OffscreenCanvasSurface> request)
24 : id_allocator_(CreateSurfaceIdAllocator()), 25 : id_allocator_(CreateSurfaceIdAllocator()),
25 binding_(this, std::move(request)) {} 26 binding_(this, std::move(request)) {}
26 27
27 OffscreenCanvasSurfaceImpl::~OffscreenCanvasSurfaceImpl() { 28 OffscreenCanvasSurfaceImpl::~OffscreenCanvasSurfaceImpl() {
29 if (!GetSurfaceManager()) {
Justin Novosad 2016/06/22 20:47:09 Is is not possible to call GetSurfaceManager in Su
xlai (Olivia) 2016/06/23 14:49:38 Cannot...cc/ folder cannot import things from cont
30 std::cout << "surface manager no longer exists! " << std::endl;
31 surface_factory_->onSurfaceManagerDestroyed();
32 }
33 surface_factory_.reset();
34 //surface_factory_->DestroyAll();
28 } 35 }
29 36
30 void OffscreenCanvasSurfaceImpl::GetSurfaceId( 37 void OffscreenCanvasSurfaceImpl::GetSurfaceId(
31 const GetSurfaceIdCallback& callback) { 38 const GetSurfaceIdCallback& callback) {
32 DCHECK_CURRENTLY_ON(BrowserThread::UI); 39 DCHECK_CURRENTLY_ON(BrowserThread::UI);
33 40
34 cc::SurfaceId surface_id = id_allocator_->GenerateId(); 41 cc::SurfaceId surface_id = id_allocator_->GenerateId();
35 42
36 callback.Run(surface_id); 43 callback.Run(surface_id);
37 } 44 }
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
69 const cc::ReturnedResourceArray& resources) {} 76 const cc::ReturnedResourceArray& resources) {}
70 77
71 void OffscreenCanvasSurfaceImpl::WillDrawSurface(cc::SurfaceId id, 78 void OffscreenCanvasSurfaceImpl::WillDrawSurface(cc::SurfaceId id,
72 const gfx::Rect& damage_rect) { 79 const gfx::Rect& damage_rect) {
73 } 80 }
74 81
75 void OffscreenCanvasSurfaceImpl::SetBeginFrameSource( 82 void OffscreenCanvasSurfaceImpl::SetBeginFrameSource(
76 cc::BeginFrameSource* begin_frame_source) {} 83 cc::BeginFrameSource* begin_frame_source) {}
77 84
78 } // namespace content 85 } // namespace content
OLDNEW
« cc/surfaces/surface_factory.cc ('K') | « content/browser/compositor/surface_utils.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698