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_forward.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/scoped_native_library.h" |
14 #include "base/synchronization/lock.h" | 15 #include "base/synchronization/lock.h" |
15 #include "base/win/scoped_comptr.h" | 16 #include "base/win/scoped_comptr.h" |
16 #include "ui/gfx/native_widget_types.h" | 17 #include "ui/gfx/native_widget_types.h" |
17 #include "ui/gfx/size.h" | 18 #include "ui/gfx/size.h" |
18 #include "ui/gfx/surface/surface_export.h" | 19 #include "ui/gfx/surface/surface_export.h" |
19 | 20 |
20 class SURFACE_EXPORT AcceleratedSurface | 21 class SURFACE_EXPORT AcceleratedSurface |
21 : public base::RefCountedThreadSafe<AcceleratedSurface> { | 22 : public base::RefCountedThreadSafe<AcceleratedSurface> { |
22 public: | 23 public: |
23 explicit AcceleratedSurface(gfx::NativeWindow parent); | 24 explicit AcceleratedSurface(gfx::NativeWindow parent); |
(...skipping 17 matching lines...) Expand all Loading... |
41 void QueriesDestroyed(); | 42 void QueriesDestroyed(); |
42 void DoDestroy(); | 43 void DoDestroy(); |
43 void DoResize(const gfx::Size& size); | 44 void DoResize(const gfx::Size& size); |
44 void DoPresentAndAcknowledge(const gfx::Size& size, | 45 void DoPresentAndAcknowledge(const gfx::Size& size, |
45 int64 surface_id, | 46 int64 surface_id, |
46 const base::Closure& completion_task); | 47 const base::Closure& completion_task); |
47 | 48 |
48 // Immutable and accessible from any thread without the lock. | 49 // Immutable and accessible from any thread without the lock. |
49 const int thread_affinity_; | 50 const int thread_affinity_; |
50 const gfx::NativeWindow window_; | 51 const gfx::NativeWindow window_; |
| 52 base::ScopedNativeLibrary d3d_module_; |
51 | 53 |
52 // The size of the swap chain once any pending resizes have been processed. | 54 // 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. | 55 // Only accessed on the UI thread so the lock is unnecessary. |
54 gfx::Size pending_size_; | 56 gfx::Size pending_size_; |
55 | 57 |
56 // The number of pending resizes. This is accessed with atomic operations so | 58 // The number of pending resizes. This is accessed with atomic operations so |
57 // the lock is not necessary. | 59 // the lock is not necessary. |
58 base::AtomicRefCount num_pending_resizes_; | 60 base::AtomicRefCount num_pending_resizes_; |
59 | 61 |
60 // Take the lock before accessing any other state. | 62 // Take the lock before accessing any other state. |
61 base::Lock lock_; | 63 base::Lock lock_; |
62 | 64 |
63 // This device's swap chain is presented to the child window. Copy semantics | 65 // This device's swap chain is presented to the child window. Copy semantics |
64 // are used so it is possible to represent it to quickly validate the window. | 66 // are used so it is possible to represent it to quickly validate the window. |
65 base::win::ScopedComPtr<IDirect3DDevice9Ex> device_; | 67 base::win::ScopedComPtr<IDirect3DDevice9Ex> device_; |
66 | 68 |
67 // This query is used to wait until a certain amount of progress has been | 69 // This query is used to wait until a certain amount of progress has been |
68 // made by the GPU and it is safe for the producer to modify its shared | 70 // made by the GPU and it is safe for the producer to modify its shared |
69 // texture again. | 71 // texture again. |
70 base::win::ScopedComPtr<IDirect3DQuery9> query_; | 72 base::win::ScopedComPtr<IDirect3DQuery9> query_; |
71 | 73 |
72 // The current size of the swap chain. | 74 // The current size of the swap chain. |
73 gfx::Size size_; | 75 gfx::Size size_; |
74 | 76 |
75 DISALLOW_COPY_AND_ASSIGN(AcceleratedSurface); | 77 DISALLOW_COPY_AND_ASSIGN(AcceleratedSurface); |
76 }; | 78 }; |
77 | 79 |
78 #endif // UI_GFX_SURFACE_ACCELERATED_SURFACE_WIN_H_ | 80 #endif // UI_GFX_SURFACE_ACCELERATED_SURFACE_WIN_H_ |
OLD | NEW |