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" |
| 11 #include "content/browser/compositor/surface_display_output_surface.h" |
11 #include "content/common/host_shared_bitmap_manager.h" | 12 #include "content/common/host_shared_bitmap_manager.h" |
12 | 13 |
13 namespace content { | 14 namespace content { |
14 | 15 |
15 OnscreenDisplayClient::OnscreenDisplayClient( | 16 OnscreenDisplayClient::OnscreenDisplayClient( |
16 scoped_ptr<cc::OutputSurface> output_surface, | 17 scoped_ptr<cc::OutputSurface> output_surface, |
17 cc::SurfaceManager* manager, | 18 cc::SurfaceManager* manager, |
18 scoped_refptr<base::SingleThreadTaskRunner> task_runner) | 19 scoped_refptr<base::SingleThreadTaskRunner> task_runner) |
19 : output_surface_(output_surface.Pass()), | 20 : output_surface_(output_surface.Pass()), |
20 display_( | 21 display_( |
21 new cc::Display(this, manager, HostSharedBitmapManager::current())), | 22 new cc::Display(this, manager, HostSharedBitmapManager::current())), |
22 task_runner_(task_runner), | 23 task_runner_(task_runner), |
23 scheduled_draw_(false), | 24 scheduled_draw_(false), |
24 deferred_draw_(false), | 25 deferred_draw_(false), |
25 pending_frames_(0), | 26 pending_frames_(0), |
26 weak_ptr_factory_(this) { | 27 weak_ptr_factory_(this) { |
27 } | 28 } |
28 | 29 |
29 OnscreenDisplayClient::~OnscreenDisplayClient() { | 30 OnscreenDisplayClient::~OnscreenDisplayClient() { |
30 } | 31 } |
31 | 32 |
32 scoped_ptr<cc::OutputSurface> OnscreenDisplayClient::CreateOutputSurface() { | 33 scoped_ptr<cc::OutputSurface> OnscreenDisplayClient::CreateOutputSurface() { |
33 DCHECK(output_surface_.get()); | 34 DCHECK(output_surface_.get()); |
34 return output_surface_.Pass(); | 35 return output_surface_.Pass(); |
35 } | 36 } |
36 | 37 |
| 38 void OnscreenDisplayClient::CommitVSyncParameters(base::TimeTicks timebase, |
| 39 base::TimeDelta interval) { |
| 40 surface_display_output_surface_->ReceivedVSyncParameters(timebase, interval); |
| 41 } |
| 42 |
37 void OnscreenDisplayClient::DisplayDamaged() { | 43 void OnscreenDisplayClient::DisplayDamaged() { |
38 if (scheduled_draw_ || deferred_draw_) | 44 if (scheduled_draw_ || deferred_draw_) |
39 return; | 45 return; |
40 TRACE_EVENT0("content", "OnscreenDisplayClient::DisplayDamaged"); | 46 TRACE_EVENT0("content", "OnscreenDisplayClient::DisplayDamaged"); |
41 if (pending_frames_ >= display_->GetMaxFramesPending()) { | 47 if (pending_frames_ >= display_->GetMaxFramesPending()) { |
42 deferred_draw_ = true; | 48 deferred_draw_ = true; |
43 } else { | 49 } else { |
44 ScheduleDraw(); | 50 ScheduleDraw(); |
45 } | 51 } |
46 } | 52 } |
(...skipping 19 matching lines...) Expand all Loading... |
66 | 72 |
67 void OnscreenDisplayClient::DidSwapBuffersComplete() { | 73 void OnscreenDisplayClient::DidSwapBuffersComplete() { |
68 pending_frames_--; | 74 pending_frames_--; |
69 if ((pending_frames_ < display_->GetMaxFramesPending()) && deferred_draw_) { | 75 if ((pending_frames_ < display_->GetMaxFramesPending()) && deferred_draw_) { |
70 deferred_draw_ = false; | 76 deferred_draw_ = false; |
71 ScheduleDraw(); | 77 ScheduleDraw(); |
72 } | 78 } |
73 } | 79 } |
74 | 80 |
75 } // namespace content | 81 } // namespace content |
OLD | NEW |