| 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 <map> | 8 #include <map> |
| 9 | 9 |
| 10 #include "base/atomic_sequence_num.h" | |
| 11 #include "base/containers/hash_tables.h" | 10 #include "base/containers/hash_tables.h" |
| 12 #include "base/memory/ref_counted.h" | 11 #include "base/memory/ref_counted.h" |
| 12 #include "base/memory/scoped_ptr.h" |
| 13 #include "base/process/process.h" | 13 #include "base/process/process.h" |
| 14 #include "content/public/browser/browser_thread.h" | 14 #include "content/public/browser/browser_thread.h" |
| 15 #include "content/public/browser/content_browser_client.h" | 15 #include "content/public/browser/content_browser_client.h" |
| 16 #include "content/public/browser/global_request_id.h" | 16 #include "content/public/browser/global_request_id.h" |
| 17 #include "content/public/common/window_container_type.h" | 17 #include "content/public/common/window_container_type.h" |
| 18 #include "third_party/WebKit/public/web/WebPopupType.h" | 18 #include "third_party/WebKit/public/web/WebPopupType.h" |
| 19 #include "ui/gfx/native_widget_types.h" | 19 #include "ui/gfx/native_widget_types.h" |
| 20 | 20 |
| 21 namespace IPC { | 21 namespace IPC { |
| 22 class Message; | 22 class Message; |
| 23 } | 23 } |
| 24 | 24 |
| 25 namespace base { | 25 namespace base { |
| 26 class TimeDelta; | 26 class TimeDelta; |
| 27 } | 27 } |
| 28 | 28 |
| 29 struct ViewHostMsg_CreateWindow_Params; | 29 struct ViewHostMsg_CreateWindow_Params; |
| 30 struct ViewMsg_SwapOut_Params; | 30 struct ViewMsg_SwapOut_Params; |
| 31 | 31 |
| 32 namespace content { | 32 namespace content { |
| 33 class GpuProcessHost; | 33 class GpuProcessHost; |
| 34 class ResourceDispatcherHostImpl; | 34 class ResourceDispatcherHostImpl; |
| 35 class RoutingIDIssuer; |
| 35 class SessionStorageNamespace; | 36 class SessionStorageNamespace; |
| 36 | 37 |
| 37 // Instantiated per RenderProcessHost to provide various optimizations on | 38 // Instantiated per RenderProcessHost to provide various optimizations on |
| 38 // behalf of a RenderWidgetHost. This class bridges between the IO thread | 39 // behalf of a RenderWidgetHost. This class bridges between the IO thread |
| 39 // where the RenderProcessHost's MessageFilter lives and the UI thread where | 40 // where the RenderProcessHost's MessageFilter lives and the UI thread where |
| 40 // the RenderWidgetHost lives. | 41 // the RenderWidgetHost lives. |
| 41 // | 42 // |
| 42 // | 43 // |
| 43 // OPTIMIZED TAB SWITCHING | 44 // OPTIMIZED TAB SWITCHING |
| 44 // | 45 // |
| (...skipping 27 matching lines...) Expand all Loading... |
| 72 : public base::RefCountedThreadSafe<RenderWidgetHelper, | 73 : public base::RefCountedThreadSafe<RenderWidgetHelper, |
| 73 BrowserThread::DeleteOnIOThread> { | 74 BrowserThread::DeleteOnIOThread> { |
| 74 public: | 75 public: |
| 75 RenderWidgetHelper(); | 76 RenderWidgetHelper(); |
| 76 | 77 |
| 77 void Init(int render_process_id, | 78 void Init(int render_process_id, |
| 78 ResourceDispatcherHostImpl* resource_dispatcher_host); | 79 ResourceDispatcherHostImpl* resource_dispatcher_host); |
| 79 | 80 |
| 80 // Gets the next available routing id. This is thread safe. | 81 // Gets the next available routing id. This is thread safe. |
| 81 int GetNextRoutingID(); | 82 int GetNextRoutingID(); |
| 83 // Probablistically verify if the ID is issued by this helper. |
| 84 // Thread safe. |
| 85 bool IsRoutingIDProbablyValid(int routing_id) const; |
| 82 | 86 |
| 83 // IO THREAD ONLY ----------------------------------------------------------- | 87 // IO THREAD ONLY ----------------------------------------------------------- |
| 84 | 88 |
| 85 // Lookup the RenderWidgetHelper from the render_process_host_id. Returns NULL | 89 // Lookup the RenderWidgetHelper from the render_process_host_id. Returns NULL |
| 86 // if not found. NOTE: The raw pointer is for temporary use only. To retain, | 90 // if not found. NOTE: The raw pointer is for temporary use only. To retain, |
| 87 // store in a scoped_refptr. | 91 // store in a scoped_refptr. |
| 88 static RenderWidgetHelper* FromProcessHostID(int render_process_host_id); | 92 static RenderWidgetHelper* FromProcessHostID(int render_process_host_id); |
| 89 | 93 |
| 90 // UI THREAD ONLY ----------------------------------------------------------- | 94 // UI THREAD ONLY ----------------------------------------------------------- |
| 91 | 95 |
| (...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 143 // Called on the IO thread to resume a paused navigation in the network | 147 // Called on the IO thread to resume a paused navigation in the network |
| 144 // stack without transferring it to a new renderer process. | 148 // stack without transferring it to a new renderer process. |
| 145 void OnResumeDeferredNavigation(const GlobalRequestID& request_id); | 149 void OnResumeDeferredNavigation(const GlobalRequestID& request_id); |
| 146 | 150 |
| 147 // Called on the IO thread to resume a navigation paused immediately after | 151 // Called on the IO thread to resume a navigation paused immediately after |
| 148 // receiving response headers. | 152 // receiving response headers. |
| 149 void OnResumeResponseDeferredAtStart(const GlobalRequestID& request_id); | 153 void OnResumeResponseDeferredAtStart(const GlobalRequestID& request_id); |
| 150 | 154 |
| 151 int render_process_id_; | 155 int render_process_id_; |
| 152 | 156 |
| 153 // The next routing id to use. | 157 scoped_ptr<RoutingIDIssuer> routing_id_issuer_; |
| 154 base::AtomicSequenceNumber next_routing_id_; | |
| 155 | 158 |
| 156 ResourceDispatcherHostImpl* resource_dispatcher_host_; | 159 ResourceDispatcherHostImpl* resource_dispatcher_host_; |
| 157 | 160 |
| 158 DISALLOW_COPY_AND_ASSIGN(RenderWidgetHelper); | 161 DISALLOW_COPY_AND_ASSIGN(RenderWidgetHelper); |
| 159 }; | 162 }; |
| 160 | 163 |
| 161 } // namespace content | 164 } // namespace content |
| 162 | 165 |
| 163 #endif // CONTENT_BROWSER_RENDERER_HOST_RENDER_WIDGET_HELPER_H_ | 166 #endif // CONTENT_BROWSER_RENDERER_HOST_RENDER_WIDGET_HELPER_H_ |
| OLD | NEW |