| 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 CONTENT_BROWSER_RENDERER_HOST_RENDER_WIDGET_RESIZE_HELPER_MAC_H_ | 5 #ifndef CONTENT_BROWSER_RENDERER_HOST_RENDER_WIDGET_RESIZE_HELPER_H_ |
| 6 #define CONTENT_BROWSER_RENDERER_HOST_RENDER_WIDGET_RESIZE_HELPER_MAC_H_ | 6 #define CONTENT_BROWSER_RENDERER_HOST_RENDER_WIDGET_RESIZE_HELPER_H_ |
| 7 | 7 |
| 8 #include "base/macros.h" | 8 #include "base/macros.h" |
| 9 | 9 |
| 10 namespace IPC { | 10 namespace IPC { |
| 11 class Message; | 11 class Message; |
| 12 } | 12 } |
| 13 | 13 |
| 14 namespace content { | 14 namespace content { |
| 15 | 15 |
| 16 // Provides functions for content to synchronize with window resize tasks being | 16 // Provides functions for content to synchronize with window resize tasks being |
| 17 // managed by ui::WindowResizeHelperMac. WindowResizeHelperMac must be | 17 // managed by ui::WindowResizeHelper. WindowResizeHelper must be |
| 18 // initialized before calling these functions. | 18 // initialized before calling these functions. |
| 19 // | 19 // |
| 20 // The IPCs that are required to create new frames for smooth resize are sent | 20 // The IPCs that are required to create new frames for smooth resize are sent |
| 21 // to the ui::WindowResizeHelperMac singleton using the PostRendererProcessMsg() | 21 // to the ui::WindowResizeHelper singleton using the PostRendererProcessMsg() |
| 22 // and PostGpuProcessMsg() methods. Usually those IPCs arrive on the IO thread | 22 // and PostGpuProcessMsg() methods. Usually those IPCs arrive on the IO thread |
| 23 // and are posted as tasks to the UI thread either by the RenderMessageFilter | 23 // and are posted as tasks to the UI thread either by the RenderMessageFilter |
| 24 // (for renderer processes) or the GpuProcessHostUIShim (for the GPU process). | 24 // (for renderer processes) or the GpuProcessHostUIShim (for the GPU process). |
| 25 // By posting them via RenderWidgetResizeHelper instead, it allows a smooth | 25 // By posting them via RenderWidgetResizeHelper instead, it allows a smooth |
| 26 // window resize to be controlled by WindowResizeHelperMac. | 26 // window resize to be controlled by WindowResizeHelper. |
| 27 class RenderWidgetResizeHelper { | 27 class RenderWidgetResizeHelper { |
| 28 public: | 28 public: |
| 29 // IO THREAD ONLY ----------------------------------------------------------- | 29 // IO THREAD ONLY ----------------------------------------------------------- |
| 30 | 30 |
| 31 // This will cause |msg| to be handled by the RenderProcessHost corresponding | 31 // This will cause |msg| to be handled by the RenderProcessHost corresponding |
| 32 // to |render_process_id|, on the UI thread. This will either happen when the | 32 // to |render_process_id|, on the UI thread. This will either happen when the |
| 33 // ordinary message loop would run it, or potentially earlier in a call to | 33 // ordinary message loop would run it, or potentially earlier in a call to |
| 34 // WindowResizeHelperMac::WaitForSingleTaskToRun(). | 34 // WindowResizeHelper::WaitForSingleTaskToRun(). |
| 35 static void PostRendererProcessMsg(int render_process_id, | 35 static void PostRendererProcessMsg(int render_process_id, |
| 36 const IPC::Message& msg); | 36 const IPC::Message& msg); |
| 37 | 37 |
| 38 // This is similar to PostRendererProcessMsg, but will handle the message in | 38 // This is similar to PostRendererProcessMsg, but will handle the message in |
| 39 // the GpuProcessHostUIShim corresponding to |gpu_host_id|. | 39 // the GpuProcessHostUIShim corresponding to |gpu_host_id|. |
| 40 static void PostGpuProcessMsg(int gpu_host_id, const IPC::Message& msg); | 40 static void PostGpuProcessMsg(int gpu_host_id, const IPC::Message& msg); |
| 41 | 41 |
| 42 private: | 42 private: |
| 43 DISALLOW_IMPLICIT_CONSTRUCTORS(RenderWidgetResizeHelper); | 43 DISALLOW_IMPLICIT_CONSTRUCTORS(RenderWidgetResizeHelper); |
| 44 }; | 44 }; |
| 45 | 45 |
| 46 } // namespace content | 46 } // namespace content |
| 47 | 47 |
| 48 #endif // CONTENT_BROWSER_RENDERER_HOST_RENDER_WIDGET_RESIZE_HELPER_MAC_H_ | 48 #endif // CONTENT_BROWSER_RENDERER_HOST_RENDER_WIDGET_RESIZE_HELPER_H_ |
| OLD | NEW |