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/gfx/surface/accelerated_surface_win.h" | 5 #include "ui/gfx/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 622 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
633 | 633 |
634 if (hr == S_FALSE) | 634 if (hr == S_FALSE) |
635 Sleep(1); | 635 Sleep(1); |
636 } while (hr == S_FALSE); | 636 } while (hr == S_FALSE); |
637 } | 637 } |
638 | 638 |
639 static const base::TimeDelta swap_delay = GetSwapDelay(); | 639 static const base::TimeDelta swap_delay = GetSwapDelay(); |
640 if (swap_delay.ToInternalValue()) | 640 if (swap_delay.ToInternalValue()) |
641 base::PlatformThread::Sleep(swap_delay); | 641 base::PlatformThread::Sleep(swap_delay); |
642 | 642 |
643 scoped_completion_runner.Release(); | |
644 if (!completion_task.is_null()) | |
645 completion_task.Run(true); | |
646 | |
647 { | 643 { |
648 TRACE_EVENT0("surface", "Present"); | 644 TRACE_EVENT0("surface", "Present"); |
649 hr = swap_chain_->Present(&rect, &rect, window_, NULL, 0); | 645 hr = swap_chain_->Present(&rect, &rect, window_, NULL, 0); |
650 if (FAILED(hr) && | 646 if (FAILED(hr) && |
651 FAILED(present_thread_->device()->CheckDeviceState(window_))) { | 647 FAILED(present_thread_->device()->CheckDeviceState(window_))) { |
652 present_thread_->ResetDevice(); | 648 present_thread_->ResetDevice(); |
653 } | 649 } |
654 } | 650 } |
655 } | 651 } |
656 | 652 |
(...skipping 21 matching lines...) Expand all Loading... |
678 return presenter_->Present(); | 674 return presenter_->Present(); |
679 } | 675 } |
680 | 676 |
681 bool AcceleratedSurface::CopyTo(const gfx::Size& size, void* buf) { | 677 bool AcceleratedSurface::CopyTo(const gfx::Size& size, void* buf) { |
682 return presenter_->CopyTo(size, buf); | 678 return presenter_->CopyTo(size, buf); |
683 } | 679 } |
684 | 680 |
685 void AcceleratedSurface::Suspend() { | 681 void AcceleratedSurface::Suspend() { |
686 presenter_->Suspend(); | 682 presenter_->Suspend(); |
687 } | 683 } |
OLD | NEW |