| OLD | NEW | 
|   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 UI_ACCELERATED_WIDGET_MAC_DISPLAY_LINK_MAC_H_ |   5 #ifndef UI_ACCELERATED_WIDGET_MAC_DISPLAY_LINK_MAC_H_ | 
|   6 #define UI_ACCELERATED_WIDGET_MAC_DISPLAY_LINK_MAC_H_ |   6 #define UI_ACCELERATED_WIDGET_MAC_DISPLAY_LINK_MAC_H_ | 
|   7  |   7  | 
 |   8 #include <map> | 
|   8 #include <QuartzCore/CVDisplayLink.h> |   9 #include <QuartzCore/CVDisplayLink.h> | 
|   9 #include <map> |  | 
|  10  |  10  | 
|  11 #include "base/lazy_instance.h" |  11 #include "base/lazy_instance.h" | 
|  12 #include "base/mac/scoped_typeref.h" |  12 #include "base/mac/scoped_typeref.h" | 
|  13 #include "base/memory/ref_counted.h" |  13 #include "base/memory/ref_counted.h" | 
|  14 #include "base/synchronization/lock.h" |  14 #include "base/synchronization/lock.h" | 
|  15 #include "base/time/time.h" |  15 #include "base/time/time.h" | 
|  16 #include "base/timer/timer.h" |  16 #include "base/timer/timer.h" | 
|  17 #include "ui/accelerated_widget_mac/accelerated_widget_mac_export.h" |  17 #include "ui/accelerated_widget_mac/accelerated_widget_mac_export.h" | 
|  18  |  18  | 
|  19 namespace ui { |  19 namespace ui { | 
|  20  |  20  | 
|  21 class ACCELERATED_WIDGET_MAC_EXPORT DisplayLinkMac : |  21 class ACCELERATED_WIDGET_MAC_EXPORT DisplayLinkMac : | 
|  22     public base::RefCounted<DisplayLinkMac> { |  22     public base::RefCounted<DisplayLinkMac> { | 
|  23  public: |  23  public: | 
|  24   static scoped_refptr<DisplayLinkMac> GetForDisplay( |  24   static scoped_refptr<DisplayLinkMac> GetForDisplay( | 
|  25       CGDirectDisplayID display_id); |  25       CGDirectDisplayID display_id); | 
|  26  |  26  | 
 |  27   CGDirectDisplayID display_id() const { return display_id_; } | 
 |  28  | 
|  27   // Get vsync scheduling parameters. |  29   // Get vsync scheduling parameters. | 
|  28   bool GetVSyncParameters( |  30   bool GetVSyncParameters( | 
|  29       base::TimeTicks* timebase, |  31       base::TimeTicks* timebase, | 
|  30       base::TimeDelta* interval); |  32       base::TimeDelta* interval); | 
|  31  |  33  | 
|  32  private: |  34  private: | 
|  33   friend class base::RefCounted<DisplayLinkMac>; |  35   friend class base::RefCounted<DisplayLinkMac>; | 
|  34  |  36  | 
|  35   DisplayLinkMac( |  37   DisplayLinkMac( | 
|  36       CGDirectDisplayID display_id, |  38       CGDirectDisplayID display_id, | 
| (...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
|  74  |  76  | 
|  75   // Each display link instance consumes a non-negligible number of cycles, so |  77   // Each display link instance consumes a non-negligible number of cycles, so | 
|  76   // make all display links on the same screen share the same object. |  78   // make all display links on the same screen share the same object. | 
|  77   typedef std::map<CGDirectDisplayID, DisplayLinkMac*> DisplayMap; |  79   typedef std::map<CGDirectDisplayID, DisplayLinkMac*> DisplayMap; | 
|  78   static base::LazyInstance<DisplayMap> display_map_; |  80   static base::LazyInstance<DisplayMap> display_map_; | 
|  79 }; |  81 }; | 
|  80  |  82  | 
|  81 }  // ui |  83 }  // ui | 
|  82  |  84  | 
|  83 #endif  // UI_ACCELERATED_WIDGET_MAC_DISPLAY_LINK_MAC_H_ |  85 #endif  // UI_ACCELERATED_WIDGET_MAC_DISPLAY_LINK_MAC_H_ | 
| OLD | NEW |