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

Side by Side Diff: content/browser/renderer_host/display_link_mac.h

Issue 147493011: Use base::ScopedTypeRef for CGL types (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebase again Created 6 years, 10 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
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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 CONTENT_BROWSER_RENDERER_HOST_DISPLAY_LINK_MAC_H_ 5 #ifndef CONTENT_BROWSER_RENDERER_HOST_DISPLAY_LINK_MAC_H_
6 #define CONTENT_BROWSER_RENDERER_HOST_DISPLAY_LINK_MAC_H_ 6 #define CONTENT_BROWSER_RENDERER_HOST_DISPLAY_LINK_MAC_H_
7 7
8 #import <QuartzCore/CVDisplayLink.h> 8 #include <QuartzCore/CVDisplayLink.h>
9 9
10 #include "base/mac/scoped_typeref.h"
10 #include "base/memory/ref_counted.h" 11 #include "base/memory/ref_counted.h"
11 #include "base/synchronization/lock.h" 12 #include "base/synchronization/lock.h"
12 #include "base/time/time.h" 13 #include "base/time/time.h"
13 #include "base/timer/timer.h" 14 #include "base/timer/timer.h"
14 15
15 namespace content { 16 namespace content {
16 17
17 class DisplayLinkMac : public base::RefCounted<DisplayLinkMac> { 18 class DisplayLinkMac : public base::RefCounted<DisplayLinkMac> {
18 public: 19 public:
19 static scoped_refptr<DisplayLinkMac> Create(); 20 static scoped_refptr<DisplayLinkMac> Create();
20 21
21 // Get vsync scheduling parameters. 22 // Get vsync scheduling parameters.
22 bool GetVSyncParameters( 23 bool GetVSyncParameters(
23 base::TimeTicks* timebase, 24 base::TimeTicks* timebase,
24 base::TimeDelta* interval); 25 base::TimeDelta* interval);
25 26
26 private: 27 private:
27 friend class base::RefCounted<DisplayLinkMac>; 28 friend class base::RefCounted<DisplayLinkMac>;
28 29
29 DisplayLinkMac(CVDisplayLinkRef display_link); 30 DisplayLinkMac(base::ScopedTypeRef<CVDisplayLinkRef> display_link);
30 virtual ~DisplayLinkMac(); 31 virtual ~DisplayLinkMac();
31 32
32 void StartOrContinueDisplayLink(); 33 void StartOrContinueDisplayLink();
33 void StopDisplayLink(); 34 void StopDisplayLink();
34 void Tick(const CVTimeStamp* time); 35 void Tick(const CVTimeStamp* time);
35 36
36 static CVReturn DisplayLinkCallback( 37 static CVReturn DisplayLinkCallback(
37 CVDisplayLinkRef display_link, 38 CVDisplayLinkRef display_link,
38 const CVTimeStamp* now, 39 const CVTimeStamp* now,
39 const CVTimeStamp* output_time, 40 const CVTimeStamp* output_time,
40 CVOptionFlags flags_in, 41 CVOptionFlags flags_in,
41 CVOptionFlags* flags_out, 42 CVOptionFlags* flags_out,
42 void* context); 43 void* context);
43 44
44 // CVDisplayLink for querying VSync timing info. 45 // CVDisplayLink for querying VSync timing info.
45 CVDisplayLinkRef display_link_; 46 base::ScopedTypeRef<CVDisplayLinkRef> display_link_;
46 47
47 // Timer for stopping the display link if it has not been queried in 48 // Timer for stopping the display link if it has not been queried in
48 // the last second. 49 // the last second.
49 base::DelayTimer<DisplayLinkMac> stop_timer_; 50 base::DelayTimer<DisplayLinkMac> stop_timer_;
50 51
51 // VSync parameters computed during Tick. 52 // VSync parameters computed during Tick.
52 bool timebase_and_interval_valid_; 53 bool timebase_and_interval_valid_;
53 base::TimeTicks timebase_; 54 base::TimeTicks timebase_;
54 base::TimeDelta interval_; 55 base::TimeDelta interval_;
55 56
56 // Lock for sharing data between UI thread and display-link thread. 57 // Lock for sharing data between UI thread and display-link thread.
57 base::Lock lock_; 58 base::Lock lock_;
58 }; 59 };
59 60
60 } // content 61 } // content
61 62
62 #endif // CONTENT_BROWSER_RENDERER_HOST_DISPLAY_LINK_MAC_H_ 63 #endif // CONTENT_BROWSER_RENDERER_HOST_DISPLAY_LINK_MAC_H_
OLDNEW
« no previous file with comments | « content/browser/renderer_host/compositing_iosurface_mac.mm ('k') | content/browser/renderer_host/display_link_mac.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698