OLD | NEW |
---|---|
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 "content/browser/compositor/onscreen_display_client.h" | 5 #include "content/browser/compositor/onscreen_display_client.h" |
6 | 6 |
7 #include "cc/output/output_surface.h" | 7 #include "cc/output/output_surface.h" |
8 #include "cc/surfaces/surface_factory.h" | 8 #include "cc/surfaces/surface_factory.h" |
9 #include "cc/surfaces/surface_manager.h" | 9 #include "cc/surfaces/surface_manager.h" |
10 #include "content/common/host_shared_bitmap_manager.h" | 10 #include "content/common/host_shared_bitmap_manager.h" |
11 | 11 |
12 namespace content { | 12 namespace content { |
13 | 13 |
14 OnscreenDisplayClient::OnscreenDisplayClient( | 14 OnscreenDisplayClient::OnscreenDisplayClient( |
15 const scoped_refptr<cc::ContextProvider>& onscreen_context_provider, | 15 const scoped_refptr<cc::ContextProvider>& onscreen_context_provider, |
16 scoped_ptr<cc::OutputSurface> software_surface, | 16 scoped_ptr<cc::OutputSurface> software_surface, |
17 cc::SurfaceManager* manager) | 17 cc::SurfaceManager* manager, |
18 scoped_refptr<base::SingleThreadTaskRunner> task_runner) | |
18 : onscreen_context_provider_(onscreen_context_provider), | 19 : onscreen_context_provider_(onscreen_context_provider), |
19 software_surface_(software_surface.Pass()), | 20 software_surface_(software_surface.Pass()), |
20 display_(new cc::Display(this, | 21 display_( |
21 manager, | 22 new cc::Display(this, manager, HostSharedBitmapManager::current())), |
22 HostSharedBitmapManager::current())) { | 23 task_runner_(task_runner), |
24 scheduled_draw_(false), | |
25 weak_ptr_factory_(this) { | |
23 } | 26 } |
24 | 27 |
25 OnscreenDisplayClient::~OnscreenDisplayClient() { | 28 OnscreenDisplayClient::~OnscreenDisplayClient() { |
26 } | 29 } |
27 | 30 |
28 scoped_ptr<cc::OutputSurface> OnscreenDisplayClient::CreateOutputSurface() { | 31 scoped_ptr<cc::OutputSurface> OnscreenDisplayClient::CreateOutputSurface() { |
29 if (!onscreen_context_provider_) | 32 if (!onscreen_context_provider_) |
30 return software_surface_.Pass(); | 33 return software_surface_.Pass(); |
31 return make_scoped_ptr(new cc::OutputSurface(onscreen_context_provider_)) | 34 return make_scoped_ptr(new cc::OutputSurface(onscreen_context_provider_)) |
32 .Pass(); | 35 .Pass(); |
33 } | 36 } |
34 | 37 |
38 void OnscreenDisplayClient::DisplayDamaged() { | |
39 if (scheduled_draw_) | |
40 return; | |
41 scheduled_draw_ = true; | |
42 task_runner_->PostTask( | |
jamesr
2014/08/11 22:04:43
could you add some traces here and to ::Draw()? we
| |
43 FROM_HERE, | |
44 base::Bind(&OnscreenDisplayClient::Draw, weak_ptr_factory_.GetWeakPtr())); | |
45 } | |
46 | |
47 void OnscreenDisplayClient::Draw() { | |
48 scheduled_draw_ = false; | |
49 display_->Draw(); | |
50 } | |
51 | |
35 } // namespace content | 52 } // namespace content |
OLD | NEW |