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

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: 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>;
29 typedef base::ScopedTypeRef<
30 CVDisplayLinkRef, CVDisplayLinkRetain, CVDisplayLinkRelease>
31 ScopedCVDisplayLinkRef;
28 32
29 DisplayLinkMac(CVDisplayLinkRef display_link); 33 DisplayLinkMac(ScopedCVDisplayLinkRef display_link);
30 virtual ~DisplayLinkMac(); 34 virtual ~DisplayLinkMac();
31 35
32 void StartOrContinueDisplayLink(); 36 void StartOrContinueDisplayLink();
33 void StopDisplayLink(); 37 void StopDisplayLink();
34 void Tick(const CVTimeStamp* time); 38 void Tick(const CVTimeStamp* time);
35 39
36 static CVReturn DisplayLinkCallback( 40 static CVReturn DisplayLinkCallback(
37 CVDisplayLinkRef display_link, 41 CVDisplayLinkRef display_link,
38 const CVTimeStamp* now, 42 const CVTimeStamp* now,
39 const CVTimeStamp* output_time, 43 const CVTimeStamp* output_time,
40 CVOptionFlags flags_in, 44 CVOptionFlags flags_in,
41 CVOptionFlags* flags_out, 45 CVOptionFlags* flags_out,
42 void* context); 46 void* context);
43 47
44 // CVDisplayLink for querying VSync timing info. 48 // CVDisplayLink for querying VSync timing info.
45 CVDisplayLinkRef display_link_; 49 ScopedCVDisplayLinkRef display_link_;
46 50
47 // Timer for stopping the display link if it has not been queried in 51 // Timer for stopping the display link if it has not been queried in
48 // the last second. 52 // the last second.
49 base::DelayTimer<DisplayLinkMac> stop_timer_; 53 base::DelayTimer<DisplayLinkMac> stop_timer_;
50 54
51 // VSync parameters computed during Tick. 55 // VSync parameters computed during Tick.
52 bool timebase_and_interval_valid_; 56 bool timebase_and_interval_valid_;
53 base::TimeTicks timebase_; 57 base::TimeTicks timebase_;
54 base::TimeDelta interval_; 58 base::TimeDelta interval_;
55 59
56 // Lock for sharing data between UI thread and display-link thread. 60 // Lock for sharing data between UI thread and display-link thread.
57 base::Lock lock_; 61 base::Lock lock_;
58 }; 62 };
59 63
60 } // content 64 } // content
61 65
62 #endif // CONTENT_BROWSER_RENDERER_HOST_DISPLAY_LINK_MAC_H_ 66 #endif // CONTENT_BROWSER_RENDERER_HOST_DISPLAY_LINK_MAC_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698