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