OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 "ui/surface/accelerated_surface_win.h" | 5 #include "ui/surface/accelerated_surface_win.h" |
6 | 6 |
7 #include <dwmapi.h> | 7 #include <dwmapi.h> |
8 #include <windows.h> | 8 #include <windows.h> |
9 #include <algorithm> | 9 #include <algorithm> |
10 | 10 |
(...skipping 839 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
850 } | 850 } |
851 | 851 |
852 { | 852 { |
853 TRACE_EVENT0("gpu", "GetPresentationStats"); | 853 TRACE_EVENT0("gpu", "GetPresentationStats"); |
854 base::TimeTicks timebase; | 854 base::TimeTicks timebase; |
855 base::TimeDelta interval; | 855 base::TimeDelta interval; |
856 uint32 numerator = 0, denominator = 0; | 856 uint32 numerator = 0, denominator = 0; |
857 if (GetPresentationStats(&timebase, &numerator, &denominator) && | 857 if (GetPresentationStats(&timebase, &numerator, &denominator) && |
858 numerator > 0 && denominator > 0) { | 858 numerator > 0 && denominator > 0) { |
859 int64 interval_micros = | 859 int64 interval_micros = |
860 static_cast<int64>(1000000 * numerator) / denominator; | 860 1000000 * static_cast<int64>(numerator) / denominator; |
861 interval = base::TimeDelta::FromMicroseconds(interval_micros); | 861 interval = base::TimeDelta::FromMicroseconds(interval_micros); |
862 } | 862 } |
863 scoped_completion_runner.Release(); | 863 scoped_completion_runner.Release(); |
864 completion_task.Run(true, timebase, interval); | 864 completion_task.Run(true, timebase, interval); |
865 TRACE_EVENT2("gpu", "GetPresentationStats", | 865 TRACE_EVENT2("gpu", "GetPresentationStats", |
866 "timebase", timebase.ToInternalValue(), | 866 "timebase", timebase.ToInternalValue(), |
867 "interval", interval.ToInternalValue()); | 867 "interval", interval.ToInternalValue()); |
868 } | 868 } |
869 | 869 |
870 hidden_ = false; | 870 hidden_ = false; |
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
923 return presenter_->CopyTo(src_subrect, dst_size, buf); | 923 return presenter_->CopyTo(src_subrect, dst_size, buf); |
924 } | 924 } |
925 | 925 |
926 void AcceleratedSurface::Suspend() { | 926 void AcceleratedSurface::Suspend() { |
927 presenter_->Suspend(); | 927 presenter_->Suspend(); |
928 } | 928 } |
929 | 929 |
930 void AcceleratedSurface::WasHidden() { | 930 void AcceleratedSurface::WasHidden() { |
931 presenter_->WasHidden(); | 931 presenter_->WasHidden(); |
932 } | 932 } |
OLD | NEW |