Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1236)

Side by Side Diff: content/browser/renderer_host/render_widget_helper.h

Issue 643733002: Add RoutingIDIssuer to ensure the correctness of ID to be routed. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 #include "ui/surface/transport_dib.h" 20 #include "ui/surface/transport_dib.h"
21 21
22 namespace IPC { 22 namespace IPC {
23 class Message; 23 class Message;
24 } 24 }
25 25
26 namespace base { 26 namespace base {
27 class TimeDelta; 27 class TimeDelta;
28 } 28 }
29 29
30 struct ViewHostMsg_CreateWindow_Params; 30 struct ViewHostMsg_CreateWindow_Params;
31 struct ViewMsg_SwapOut_Params; 31 struct ViewMsg_SwapOut_Params;
32 32
33 namespace content { 33 namespace content {
34 class GpuProcessHost; 34 class GpuProcessHost;
35 class ResourceDispatcherHostImpl; 35 class ResourceDispatcherHostImpl;
36 class RoutingIDIssuer;
36 class SessionStorageNamespace; 37 class SessionStorageNamespace;
37 38
38 // Instantiated per RenderProcessHost to provide various optimizations on 39 // Instantiated per RenderProcessHost to provide various optimizations on
39 // behalf of a RenderWidgetHost. This class bridges between the IO thread 40 // behalf of a RenderWidgetHost. This class bridges between the IO thread
40 // where the RenderProcessHost's MessageFilter lives and the UI thread where 41 // where the RenderProcessHost's MessageFilter lives and the UI thread where
41 // the RenderWidgetHost lives. 42 // the RenderWidgetHost lives.
42 // 43 //
43 // 44 //
44 // OPTIMIZED TAB SWITCHING 45 // OPTIMIZED TAB SWITCHING
45 // 46 //
(...skipping 27 matching lines...) Expand all
73 : public base::RefCountedThreadSafe<RenderWidgetHelper, 74 : public base::RefCountedThreadSafe<RenderWidgetHelper,
74 BrowserThread::DeleteOnIOThread> { 75 BrowserThread::DeleteOnIOThread> {
75 public: 76 public:
76 RenderWidgetHelper(); 77 RenderWidgetHelper();
77 78
78 void Init(int render_process_id, 79 void Init(int render_process_id,
79 ResourceDispatcherHostImpl* resource_dispatcher_host); 80 ResourceDispatcherHostImpl* resource_dispatcher_host);
80 81
81 // Gets the next available routing id. This is thread safe. 82 // Gets the next available routing id. This is thread safe.
82 int GetNextRoutingID(); 83 int GetNextRoutingID();
84 // Probablistically verify if he ID is issued by this helper.
nasko 2014/10/13 21:04:00 nit: s/if he/if the/
Hajime Morrita 2014/10/13 22:23:54 Done.
85 // Thread safe.
86 int IsRoutingIDProbablyValid(int routing_id) const;
nasko 2014/10/13 21:04:00 Why return int, when the expected output value is
Hajime Morrita 2014/10/13 22:23:54 Oops. should've returned a bool.
83 87
84 // IO THREAD ONLY ----------------------------------------------------------- 88 // IO THREAD ONLY -----------------------------------------------------------
85 89
86 // Lookup the RenderWidgetHelper from the render_process_host_id. Returns NULL 90 // Lookup the RenderWidgetHelper from the render_process_host_id. Returns NULL
87 // if not found. NOTE: The raw pointer is for temporary use only. To retain, 91 // if not found. NOTE: The raw pointer is for temporary use only. To retain,
88 // store in a scoped_refptr. 92 // store in a scoped_refptr.
89 static RenderWidgetHelper* FromProcessHostID(int render_process_host_id); 93 static RenderWidgetHelper* FromProcessHostID(int render_process_host_id);
90 94
91 // UI THREAD ONLY ----------------------------------------------------------- 95 // UI THREAD ONLY -----------------------------------------------------------
92 96
(...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after
168 void ClearAllocatedDIBs(); 172 void ClearAllocatedDIBs();
169 173
170 // On POSIX we keep file descriptors to all the allocated DIBs around until 174 // On POSIX we keep file descriptors to all the allocated DIBs around until
171 // the renderer frees them. 175 // the renderer frees them.
172 base::Lock allocated_dibs_lock_; 176 base::Lock allocated_dibs_lock_;
173 std::map<TransportDIB::Id, int> allocated_dibs_; 177 std::map<TransportDIB::Id, int> allocated_dibs_;
174 #endif 178 #endif
175 179
176 int render_process_id_; 180 int render_process_id_;
177 181
178 // The next routing id to use. 182 scoped_ptr<RoutingIDIssuer> routing_id_issuer_;
179 base::AtomicSequenceNumber next_routing_id_;
180 183
181 ResourceDispatcherHostImpl* resource_dispatcher_host_; 184 ResourceDispatcherHostImpl* resource_dispatcher_host_;
182 185
183 DISALLOW_COPY_AND_ASSIGN(RenderWidgetHelper); 186 DISALLOW_COPY_AND_ASSIGN(RenderWidgetHelper);
184 }; 187 };
185 188
186 } // namespace content 189 } // namespace content
187 190
188 #endif // CONTENT_BROWSER_RENDERER_HOST_RENDER_WIDGET_HELPER_H_ 191 #endif // CONTENT_BROWSER_RENDERER_HOST_RENDER_WIDGET_HELPER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698