| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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_HELPER_H_ | 5 #ifndef CONTENT_BROWSER_RENDERER_HOST_RENDER_WIDGET_HELPER_H_ |
| 6 #define CONTENT_BROWSER_RENDERER_HOST_RENDER_WIDGET_HELPER_H_ | 6 #define CONTENT_BROWSER_RENDERER_HOST_RENDER_WIDGET_HELPER_H_ |
| 7 | 7 |
| 8 #include <stdint.h> | 8 #include <stdint.h> |
| 9 | 9 |
| 10 #include <map> | 10 #include <map> |
| (...skipping 11 matching lines...) Expand all Loading... |
| 22 #include "ui/gfx/native_widget_types.h" | 22 #include "ui/gfx/native_widget_types.h" |
| 23 | 23 |
| 24 namespace content { | 24 namespace content { |
| 25 class ResourceDispatcherHostImpl; | 25 class ResourceDispatcherHostImpl; |
| 26 class SessionStorageNamespace; | 26 class SessionStorageNamespace; |
| 27 | 27 |
| 28 // Instantiated per RenderProcessHost to provide various optimizations on | 28 // Instantiated per RenderProcessHost to provide various optimizations on |
| 29 // behalf of a RenderWidgetHost. This class bridges between the IO thread | 29 // behalf of a RenderWidgetHost. This class bridges between the IO thread |
| 30 // where the RenderProcessHost's MessageFilter lives and the UI thread where | 30 // where the RenderProcessHost's MessageFilter lives and the UI thread where |
| 31 // the RenderWidgetHost lives. | 31 // the RenderWidgetHost lives. |
| 32 // | |
| 33 // | |
| 34 // OPTIMIZED TAB SWITCHING | |
| 35 // | |
| 36 // When a RenderWidgetHost is in a background tab, it is flagged as hidden. | |
| 37 // This causes the corresponding RenderWidget to stop sending BackingStore | |
| 38 // messages. The RenderWidgetHost also discards its backingstore when it is | |
| 39 // hidden, which helps free up memory. As a result, when a RenderWidgetHost | |
| 40 // is restored, it can be momentarily be without a backingstore. (Restoring | |
| 41 // a RenderWidgetHost results in a WasShown message being sent to the | |
| 42 // RenderWidget, which triggers a full BackingStore message.) This can lead | |
| 43 // to an observed rendering glitch as the WebContentsImpl will just have to | |
| 44 // fill white overtop the RenderWidgetHost until the RenderWidgetHost | |
| 45 // receives a BackingStore message to refresh its backingstore. | |
| 46 // | |
| 47 // To avoid this 'white flash', the RenderWidgetHost again makes use of the | |
| 48 // RenderWidgetHelper's WaitForBackingStoreMsg method. When the | |
| 49 // RenderWidgetHost's GetBackingStore method is called, it will call | |
| 50 // WaitForBackingStoreMsg if it has no backingstore. | |
| 51 // | |
| 52 // TRANSPORT DIB CREATION | |
| 53 // | |
| 54 // On some platforms (currently the Mac) the renderer cannot create transport | |
| 55 // DIBs because of sandbox limitations. Thus, it has to make synchronous IPCs | |
| 56 // to the browser for them. Since these requests are synchronous, they cannot | |
| 57 // terminate on the UI thread. Thus, in this case, this object performs the | |
| 58 // allocation and maintains the set of allocated transport DIBs which the | |
| 59 // renderers can refer to. | |
| 60 // | |
| 61 | |
| 62 class RenderWidgetHelper | 32 class RenderWidgetHelper |
| 63 : public base::RefCountedThreadSafe<RenderWidgetHelper, | 33 : public base::RefCountedThreadSafe<RenderWidgetHelper, |
| 64 BrowserThread::DeleteOnIOThread> { | 34 BrowserThread::DeleteOnIOThread> { |
| 65 public: | 35 public: |
| 66 RenderWidgetHelper(); | 36 RenderWidgetHelper(); |
| 67 | 37 |
| 68 void Init(int render_process_id, | 38 void Init(int render_process_id, |
| 69 ResourceDispatcherHostImpl* resource_dispatcher_host); | 39 ResourceDispatcherHostImpl* resource_dispatcher_host); |
| 70 | 40 |
| 71 // Gets the next available routing id. This is thread safe. | 41 // Gets the next available routing id. This is thread safe. |
| (...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 135 base::AtomicSequenceNumber next_routing_id_; | 105 base::AtomicSequenceNumber next_routing_id_; |
| 136 | 106 |
| 137 ResourceDispatcherHostImpl* resource_dispatcher_host_; | 107 ResourceDispatcherHostImpl* resource_dispatcher_host_; |
| 138 | 108 |
| 139 DISALLOW_COPY_AND_ASSIGN(RenderWidgetHelper); | 109 DISALLOW_COPY_AND_ASSIGN(RenderWidgetHelper); |
| 140 }; | 110 }; |
| 141 | 111 |
| 142 } // namespace content | 112 } // namespace content |
| 143 | 113 |
| 144 #endif // CONTENT_BROWSER_RENDERER_HOST_RENDER_WIDGET_HELPER_H_ | 114 #endif // CONTENT_BROWSER_RENDERER_HOST_RENDER_WIDGET_HELPER_H_ |
| OLD | NEW |