Upstream version 5.34.104.0
[platform/framework/web/crosswalk.git] / src / content / browser / renderer_host / render_widget_host_view_mac.h
index e0617c2..e141633 100644 (file)
@@ -435,6 +435,11 @@ class RenderWidgetHostViewMac : public RenderWidgetHostViewBase,
   scoped_ptr<CompositingIOSurfaceMac> compositing_iosurface_;
   scoped_refptr<CompositingIOSurfaceContext> compositing_iosurface_context_;
 
+  // Timer used to dynamically transition the compositing layer in and out of
+  // asynchronous mode.
+  base::DelayTimer<RenderWidgetHostViewMac>
+      compositing_iosurface_layer_async_timer_;
+
   // This holds the current software compositing framebuffer, if any.
   scoped_ptr<SoftwareFrameManager> software_frame_manager_;
 
@@ -444,7 +449,16 @@ class RenderWidgetHostViewMac : public RenderWidgetHostViewBase,
   // Whether to use the CoreAnimation path to draw content.
   bool use_core_animation_;
 
-  std::vector<ui::LatencyInfo> software_latency_info_;
+  // Latency info to send back when the next frame appears on the
+  // screen.
+  std::vector<ui::LatencyInfo> pending_latency_info_;
+
+  // When taking a screenshot when using CoreAnimation, add a delay of
+  // a few frames to ensure that the contents have reached the screen
+  // before reporting latency info.
+  uint32 pending_latency_info_delay_;
+  base::WeakPtrFactory<RenderWidgetHostViewMac>
+      pending_latency_info_delay_weak_ptr_factory_;
 
   NSWindow* pepper_fullscreen_window() const {
     return pepper_fullscreen_window_;
@@ -464,7 +478,10 @@ class RenderWidgetHostViewMac : public RenderWidgetHostViewBase,
 
   float scale_factor() const;
 
-  void SendSoftwareLatencyInfoToHost();
+  void AddPendingLatencyInfo(
+      const std::vector<ui::LatencyInfo>& latency_info);
+  void SendPendingLatencyInfoToHost();
+  void TickPendingLatencyInfoDelay();
 
  private:
   friend class RenderWidgetHostView;
@@ -500,6 +517,10 @@ class RenderWidgetHostViewMac : public RenderWidgetHostViewBase,
   // Called when a software DIB is received.
   void GotSoftwareFrame();
 
+  // Called if it has been a quarter-second since a GPU SwapBuffers has been
+  // received. In this case, switch from polling for frames to pushing them.
+  void TimerSinceGotAcceleratedFrameFired();
+
   void OnPluginFocusChanged(bool focused, int plugin_id);
   void OnStartPluginIme();