OLD | NEW |
---|---|
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 #ifndef UI_GFX_SURFACE_ACCELERATED_SURFACE_WIN_H_ | 5 #ifndef UI_GFX_SURFACE_ACCELERATED_SURFACE_WIN_H_ |
6 #define UI_GFX_SURFACE_ACCELERATED_SURFACE_WIN_H_ | 6 #define UI_GFX_SURFACE_ACCELERATED_SURFACE_WIN_H_ |
7 #pragma once | 7 #pragma once |
8 | 8 |
9 #include <d3d9.h> | 9 #include <d3d9.h> |
10 | 10 |
11 #include "base/callback.h" | 11 #include "base/callback_forward.h" |
12 #include "base/memory/ref_counted.h" | 12 #include "base/memory/ref_counted.h" |
13 #include "base/message_loop_proxy.h" | 13 #include "base/message_loop_proxy.h" |
14 #include "base/synchronization/lock.h" | 14 #include "base/synchronization/lock.h" |
15 #include "base/win/scoped_comptr.h" | 15 #include "base/win/scoped_comptr.h" |
16 #include "ui/gfx/native_widget_types.h" | 16 #include "ui/gfx/native_widget_types.h" |
17 #include "ui/gfx/size.h" | 17 #include "ui/gfx/size.h" |
18 #include "ui/gfx/surface/surface_export.h" | 18 #include "ui/gfx/surface/surface_export.h" |
19 | 19 |
20 class SURFACE_EXPORT AcceleratedSurface | 20 class SURFACE_EXPORT AcceleratedSurface |
21 : public base::RefCountedThreadSafe<AcceleratedSurface> { | 21 : public base::RefCountedThreadSafe<AcceleratedSurface> { |
22 public: | 22 public: |
23 explicit AcceleratedSurface(gfx::NativeWindow parent); | 23 explicit AcceleratedSurface(gfx::NativeWindow parent); |
24 ~AcceleratedSurface(); | 24 ~AcceleratedSurface(); |
25 | 25 |
26 void Initialize(); | 26 void Initialize(); |
27 void Destroy(); | 27 void Destroy(); |
28 | 28 |
29 // Schedule a frame to be presented. The completion callback will be invoked | 29 // Schedule a frame to be presented. The completion callback will be invoked |
30 // when it is safe to write to the surface on another thread. The lock for | 30 // when it is safe to write to the surface on another thread. The lock for |
31 // this surface will be held while the completion callback runs. | 31 // this surface will be held while the completion callback runs. |
32 void AsyncPresentAndAcknowledge(const gfx::Size& size, | 32 void AsyncPresentAndAcknowledge(const gfx::Size& size, |
33 int64 surface_id, | 33 int64 surface_id, |
34 base::Closure completion_task); | 34 base::Closure completion_task); |
awong
2011/11/28 18:43:35
This should be const base::Closure&.
Would it be
erikwright (departed)
2011/11/28 19:12:19
Done.
| |
35 | 35 |
36 // Synchronously present a frame with no acknowledgement. | 36 // Synchronously present a frame with no acknowledgement. |
37 void Present(); | 37 void Present(); |
38 | 38 |
39 private: | 39 private: |
40 void DoInitialize(); | 40 void DoInitialize(); |
41 void QueriesDestroyed(); | 41 void QueriesDestroyed(); |
42 void DoDestroy(); | 42 void DoDestroy(); |
43 void DoResize(const gfx::Size& size); | 43 void DoResize(const gfx::Size& size); |
44 void DoPresentAndAcknowledge(const gfx::Size& size, | 44 void DoPresentAndAcknowledge(const gfx::Size& size, |
45 int64 surface_id, | 45 int64 surface_id, |
46 base::Closure completion_task); | 46 base::Closure completion_task); |
awong
2011/11/28 18:43:35
Same comment as above.
erikwright (departed)
2011/11/28 19:12:19
Done.
| |
47 | 47 |
48 // Immutable and accessible from any thread without the lock. | 48 // Immutable and accessible from any thread without the lock. |
49 const int thread_affinity_; | 49 const int thread_affinity_; |
50 const gfx::NativeWindow window_; | 50 const gfx::NativeWindow window_; |
51 | 51 |
52 // The size of the swap chain once any pending resizes have been processed. | 52 // The size of the swap chain once any pending resizes have been processed. |
53 // Only accessed on the UI thread so the lock is unnecessary. | 53 // Only accessed on the UI thread so the lock is unnecessary. |
54 gfx::Size pending_size_; | 54 gfx::Size pending_size_; |
55 | 55 |
56 // The number of pending resizes. This is accessed with atomic operations so | 56 // The number of pending resizes. This is accessed with atomic operations so |
(...skipping 12 matching lines...) Expand all Loading... | |
69 // texture again. | 69 // texture again. |
70 base::win::ScopedComPtr<IDirect3DQuery9> query_; | 70 base::win::ScopedComPtr<IDirect3DQuery9> query_; |
71 | 71 |
72 // The current size of the swap chain. | 72 // The current size of the swap chain. |
73 gfx::Size size_; | 73 gfx::Size size_; |
74 | 74 |
75 DISALLOW_COPY_AND_ASSIGN(AcceleratedSurface); | 75 DISALLOW_COPY_AND_ASSIGN(AcceleratedSurface); |
76 }; | 76 }; |
77 | 77 |
78 #endif // UI_GFX_SURFACE_ACCELERATED_SURFACE_WIN_H_ | 78 #endif // UI_GFX_SURFACE_ACCELERATED_SURFACE_WIN_H_ |
OLD | NEW |