Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(105)

Side by Side Diff: ui/surface/accelerated_surface_win.h

Issue 11642051: Reland 174257 with fix for win_aura (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: rebase Created 7 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « content/browser/gpu/gpu_process_host.cc ('k') | ui/surface/accelerated_surface_win.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 #ifndef UI_SURFACE_ACCELERATED_SURFACE_WIN_H_ 5 #ifndef UI_SURFACE_ACCELERATED_SURFACE_WIN_H_
6 #define UI_SURFACE_ACCELERATED_SURFACE_WIN_H_ 6 #define UI_SURFACE_ACCELERATED_SURFACE_WIN_H_
7 7
8 #include <d3d9.h> 8 #include <d3d9.h>
9 9
10 #include "base/callback_forward.h" 10 #include "base/callback_forward.h"
11 #include "base/memory/ref_counted.h" 11 #include "base/memory/ref_counted.h"
12 #include "base/single_thread_task_runner.h" 12 #include "base/single_thread_task_runner.h"
13 #include "base/synchronization/lock.h" 13 #include "base/synchronization/lock.h"
14 #include "base/synchronization/waitable_event.h" 14 #include "base/synchronization/waitable_event.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/surface/surface_export.h" 18 #include "ui/surface/surface_export.h"
19 19
20 class PresentThread; 20 class PresentThread;
21 21
22 namespace gfx { 22 namespace gfx {
23 class Rect; 23 class Rect;
24 } 24 }
25 25
26 class SURFACE_EXPORT AcceleratedPresenter 26 class SURFACE_EXPORT AcceleratedPresenter
27 : public base::RefCountedThreadSafe<AcceleratedPresenter> { 27 : public base::RefCountedThreadSafe<AcceleratedPresenter> {
28 public: 28 public:
29 typedef base::Callback<void(bool, 29 typedef base::Callback<void(bool)> CopyCompletionTask;
30 base::TimeTicks, 30
31 base::TimeDelta)> CompletionTask; 31 typedef base::Callback<void(base::TimeTicks,
32 base::TimeDelta)> PresentCompletionTask;
32 33
33 explicit AcceleratedPresenter(gfx::PluginWindowHandle window); 34 explicit AcceleratedPresenter(gfx::PluginWindowHandle window);
34 35
35 // Returns a thread safe reference to the presenter for the given window or 36 // Returns a thread safe reference to the presenter for the given window or
36 // null is no such presenter exists. The thread safe refptr ensures the 37 // null is no such presenter exists. The thread safe refptr ensures the
37 // presenter will not be destroyed. This can be called on any thread. 38 // presenter will not be destroyed. This can be called on any thread.
38 static scoped_refptr<AcceleratedPresenter> GetForWindow( 39 static scoped_refptr<AcceleratedPresenter> GetForWindow(
39 gfx::PluginWindowHandle window); 40 gfx::PluginWindowHandle window);
40 41
41 // Schedule a frame to be presented. The completion callback will be invoked 42 // Schedule a frame to be presented. The completion callback will be invoked
42 // when it is safe to write to the surface on another thread. The lock for 43 // when it is safe to write to the surface on another thread. The lock for
43 // this surface will be held while the completion callback runs. This can be 44 // this surface will be held while the completion callback runs. This can be
44 // called on any thread. 45 // called on any thread.
45 void AsyncPresentAndAcknowledge( 46 void AsyncPresentAndAcknowledge(
46 const gfx::Size& size, 47 const gfx::Size& size,
47 int64 surface_handle, 48 int64 surface_handle,
48 const CompletionTask& completion_task); 49 const CopyCompletionTask& copy_completion_task,
50 const PresentCompletionTask& present_completion_task);
49 51
50 // Schedule the presenter to free all its resources. This can be called on any 52 // Schedule the presenter to free all its resources. This can be called on any
51 // thread. 53 // thread.
52 void Suspend(); 54 void Suspend();
53 55
54 // Indicates that the presenter has become invisible. 56 // Indicates that the presenter has become invisible.
55 void WasHidden(); 57 void WasHidden();
56 58
57 // Schedule the presenter to release its reference to the shared surface. 59 // Schedule the presenter to release its reference to the shared surface.
58 void ReleaseSurface(); 60 void ReleaseSurface();
(...skipping 15 matching lines...) Expand all
74 private: 76 private:
75 friend class base::RefCountedThreadSafe<AcceleratedPresenter>; 77 friend class base::RefCountedThreadSafe<AcceleratedPresenter>;
76 78
77 ~AcceleratedPresenter(); 79 ~AcceleratedPresenter();
78 80
79 // These member functions are called on the PresentThread with which the 81 // These member functions are called on the PresentThread with which the
80 // presenter has affinity. 82 // presenter has affinity.
81 void DoPresentAndAcknowledge( 83 void DoPresentAndAcknowledge(
82 const gfx::Size& size, 84 const gfx::Size& size,
83 int64 surface_handle, 85 int64 surface_handle,
84 const CompletionTask& completion_task); 86 const CopyCompletionTask& copy_completion_task,
87 const PresentCompletionTask& present_completion_task);
85 void DoSuspend(); 88 void DoSuspend();
86 void DoPresent(const base::Closure& composite_task); 89 void DoPresent(const base::Closure& composite_task);
87 void DoReleaseSurface(); 90 void DoReleaseSurface();
88 void DoCopyToAndAcknowledge( 91 void DoCopyToAndAcknowledge(
89 const gfx::Rect& src_subrect, 92 const gfx::Rect& src_subrect,
90 const gfx::Size& dst_size, 93 const gfx::Size& dst_size,
91 void* buf, 94 void* buf,
92 scoped_refptr<base::SingleThreadTaskRunner> callback_runner, 95 scoped_refptr<base::SingleThreadTaskRunner> callback_runner,
93 const base::Callback<void(bool)>& callback); 96 const base::Callback<void(bool)>& callback);
94 bool DoCopyTo(const gfx::Rect& src_subrect, 97 bool DoCopyTo(const gfx::Rect& src_subrect,
(...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after
174 177
175 // Indicates that the surface has become invisible. 178 // Indicates that the surface has become invisible.
176 void WasHidden(); 179 void WasHidden();
177 180
178 private: 181 private:
179 const scoped_refptr<AcceleratedPresenter> presenter_; 182 const scoped_refptr<AcceleratedPresenter> presenter_;
180 DISALLOW_COPY_AND_ASSIGN(AcceleratedSurface); 183 DISALLOW_COPY_AND_ASSIGN(AcceleratedSurface);
181 }; 184 };
182 185
183 #endif // UI_SURFACE_ACCELERATED_SURFACE_WIN_H_ 186 #endif // UI_SURFACE_ACCELERATED_SURFACE_WIN_H_
OLDNEW
« no previous file with comments | « content/browser/gpu/gpu_process_host.cc ('k') | ui/surface/accelerated_surface_win.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698