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 "base/debug/trace_event.h" | 7 #include "base/debug/trace_event.h" |
8 #include "cc/output/output_surface.h" | 8 #include "cc/output/output_surface.h" |
9 #include "cc/surfaces/surface_factory.h" | 9 #include "cc/surfaces/surface_factory.h" |
10 #include "cc/surfaces/surface_manager.h" | 10 #include "cc/surfaces/surface_manager.h" |
(...skipping 12 matching lines...) Expand all Loading... |
23 new cc::Display(this, manager, HostSharedBitmapManager::current())), | 23 new cc::Display(this, manager, HostSharedBitmapManager::current())), |
24 task_runner_(task_runner), | 24 task_runner_(task_runner), |
25 scheduled_draw_(false), | 25 scheduled_draw_(false), |
26 weak_ptr_factory_(this) { | 26 weak_ptr_factory_(this) { |
27 } | 27 } |
28 | 28 |
29 OnscreenDisplayClient::~OnscreenDisplayClient() { | 29 OnscreenDisplayClient::~OnscreenDisplayClient() { |
30 } | 30 } |
31 | 31 |
32 scoped_ptr<cc::OutputSurface> OnscreenDisplayClient::CreateOutputSurface() { | 32 scoped_ptr<cc::OutputSurface> OnscreenDisplayClient::CreateOutputSurface() { |
33 if (!onscreen_context_provider_) | 33 if (!onscreen_context_provider_.get()) |
34 return software_surface_.Pass(); | 34 return software_surface_.Pass(); |
35 return make_scoped_ptr(new cc::OutputSurface(onscreen_context_provider_)) | 35 return make_scoped_ptr(new cc::OutputSurface(onscreen_context_provider_)) |
36 .Pass(); | 36 .Pass(); |
37 } | 37 } |
38 | 38 |
39 void OnscreenDisplayClient::DisplayDamaged() { | 39 void OnscreenDisplayClient::DisplayDamaged() { |
40 if (scheduled_draw_) | 40 if (scheduled_draw_) |
41 return; | 41 return; |
42 TRACE_EVENT0("content", "OnscreenDisplayClient::DisplayDamaged"); | 42 TRACE_EVENT0("content", "OnscreenDisplayClient::DisplayDamaged"); |
43 scheduled_draw_ = true; | 43 scheduled_draw_ = true; |
44 task_runner_->PostTask( | 44 task_runner_->PostTask( |
45 FROM_HERE, | 45 FROM_HERE, |
46 base::Bind(&OnscreenDisplayClient::Draw, weak_ptr_factory_.GetWeakPtr())); | 46 base::Bind(&OnscreenDisplayClient::Draw, weak_ptr_factory_.GetWeakPtr())); |
47 } | 47 } |
48 | 48 |
49 void OnscreenDisplayClient::Draw() { | 49 void OnscreenDisplayClient::Draw() { |
50 TRACE_EVENT0("content", "OnscreenDisplayClient::Draw"); | 50 TRACE_EVENT0("content", "OnscreenDisplayClient::Draw"); |
51 scheduled_draw_ = false; | 51 scheduled_draw_ = false; |
52 display_->Draw(); | 52 display_->Draw(); |
53 } | 53 } |
54 | 54 |
55 } // namespace content | 55 } // namespace content |
OLD | NEW |