| 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 <windows.h> | 7 #include <windows.h> |
| 8 #include <algorithm> | 8 #include <algorithm> |
| 9 | 9 |
| 10 #include "base/bind.h" | 10 #include "base/bind.h" |
| (...skipping 483 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 494 present_size_.width(), present_size_.height() | 494 present_size_.width(), present_size_.height() |
| 495 }; | 495 }; |
| 496 | 496 |
| 497 { | 497 { |
| 498 TRACE_EVENT0("gpu", "PresentEx"); | 498 TRACE_EVENT0("gpu", "PresentEx"); |
| 499 hr = swap_chain_->Present(&present_rect, | 499 hr = swap_chain_->Present(&present_rect, |
| 500 &present_rect, | 500 &present_rect, |
| 501 window_, | 501 window_, |
| 502 NULL, | 502 NULL, |
| 503 D3DPRESENT_INTERVAL_IMMEDIATE); | 503 D3DPRESENT_INTERVAL_IMMEDIATE); |
| 504 // For latency_tests.cc: |
| 505 UNSHIPPED_TRACE_EVENT_INSTANT0("test_gpu", "CompositorSwapBuffersComplete"); |
| 504 if (FAILED(hr)) | 506 if (FAILED(hr)) |
| 505 return false; | 507 return false; |
| 506 } | 508 } |
| 507 | 509 |
| 508 return true; | 510 return true; |
| 509 } | 511 } |
| 510 | 512 |
| 511 bool AcceleratedPresenter::CopyTo(const gfx::Size& size, void* buf) { | 513 bool AcceleratedPresenter::CopyTo(const gfx::Size& size, void* buf) { |
| 512 base::AutoLock locked(lock_); | 514 base::AutoLock locked(lock_); |
| 513 | 515 |
| (...skipping 309 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 823 } while (hr == S_FALSE); | 825 } while (hr == S_FALSE); |
| 824 } | 826 } |
| 825 | 827 |
| 826 static const base::TimeDelta swap_delay = GetSwapDelay(); | 828 static const base::TimeDelta swap_delay = GetSwapDelay(); |
| 827 if (swap_delay.ToInternalValue()) | 829 if (swap_delay.ToInternalValue()) |
| 828 base::PlatformThread::Sleep(swap_delay); | 830 base::PlatformThread::Sleep(swap_delay); |
| 829 | 831 |
| 830 { | 832 { |
| 831 TRACE_EVENT0("gpu", "Present"); | 833 TRACE_EVENT0("gpu", "Present"); |
| 832 hr = swap_chain_->Present(&rect, &rect, window_, NULL, 0); | 834 hr = swap_chain_->Present(&rect, &rect, window_, NULL, 0); |
| 835 // For latency_tests.cc: |
| 836 UNSHIPPED_TRACE_EVENT_INSTANT0("test_gpu", "CompositorSwapBuffersComplete"); |
| 833 if (FAILED(hr) && | 837 if (FAILED(hr) && |
| 834 FAILED(present_thread_->device()->CheckDeviceState(window_))) { | 838 FAILED(present_thread_->device()->CheckDeviceState(window_))) { |
| 835 present_thread_->ResetDevice(); | 839 present_thread_->ResetDevice(); |
| 836 } | 840 } |
| 837 } | 841 } |
| 838 | 842 |
| 839 hidden_ = false; | 843 hidden_ = false; |
| 840 } | 844 } |
| 841 | 845 |
| 842 void AcceleratedPresenter::DoSuspend() { | 846 void AcceleratedPresenter::DoSuspend() { |
| (...skipping 24 matching lines...) Expand all Loading... |
| 867 return presenter_->CopyTo(size, buf); | 871 return presenter_->CopyTo(size, buf); |
| 868 } | 872 } |
| 869 | 873 |
| 870 void AcceleratedSurface::Suspend() { | 874 void AcceleratedSurface::Suspend() { |
| 871 presenter_->Suspend(); | 875 presenter_->Suspend(); |
| 872 } | 876 } |
| 873 | 877 |
| 874 void AcceleratedSurface::WasHidden() { | 878 void AcceleratedSurface::WasHidden() { |
| 875 presenter_->WasHidden(); | 879 presenter_->WasHidden(); |
| 876 } | 880 } |
| OLD | NEW |