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

Side by Side Diff: content/browser/cross_site_request_manager.h

Issue 464593003: Don't swap out the old RenderFrameHost until the new one commits. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Rebase past PlzNavigate CL Created 6 years, 4 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 | Annotate | Revision Log
« no previous file with comments | « no previous file | content/browser/cross_site_request_manager.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
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
3 // found in the LICENSE file.
4
5 #ifndef CONTENT_BROWSER_CROSS_SITE_REQUEST_MANAGER_H_
6 #define CONTENT_BROWSER_CROSS_SITE_REQUEST_MANAGER_H_
7
8 #include <set>
9 #include <utility>
10
11 #include "base/basictypes.h"
12 #include "base/synchronization/lock.h"
13
14 template <typename T> struct DefaultSingletonTraits;
15
16 namespace content {
17
18 // CrossSiteRequestManager is used to handle bookkeeping for cross-site
19 // requests and responses between the UI and IO threads. Such requests involve
20 // a transition from one RenderFrameHost to another within WebContentsImpl, and
21 // involve coordination with ResourceDispatcherHost.
22 //
23 // CrossSiteRequestManager is a singleton that may be used on any thread.
24 //
25 class CrossSiteRequestManager {
26 public:
27 // Returns the singleton instance.
28 static CrossSiteRequestManager* GetInstance();
29
30 // Returns whether the RenderFrameHost specified by the given IDs currently
31 // has a pending cross-site request. If so, we will have to delay the
32 // response until the previous RenderFrameHost runs its onunload handler.
33 // Called by ResourceDispatcherHost on the IO thread and RenderFrameHost on
34 // the UI thread.
35 bool HasPendingCrossSiteRequest(int renderer_id, int render_frame_id);
36
37 // Sets whether the RenderFrameHost specified by the given IDs currently has a
38 // pending cross-site request. Called by RenderFrameHost on the UI thread.
39 void SetHasPendingCrossSiteRequest(int renderer_id,
40 int render_frame_id,
41 bool has_pending);
42
43 private:
44 friend struct DefaultSingletonTraits<CrossSiteRequestManager>;
45 typedef std::set<std::pair<int, int> > RenderFrameSet;
46
47 CrossSiteRequestManager();
48 ~CrossSiteRequestManager();
49
50 // You must acquire this lock before reading or writing any members of this
51 // class. You must not block while holding this lock.
52 base::Lock lock_;
53
54 // Set of (render_process_host_id, render_frame_id) pairs of all
55 // RenderFrameHosts that have pending cross-site requests. Used to pass
56 // information about the RenderFrameHosts between the UI and IO threads.
57 RenderFrameSet pending_cross_site_frames_;
58
59 DISALLOW_COPY_AND_ASSIGN(CrossSiteRequestManager);
60 };
61
62 } // namespace content
63
64 #endif // CONTENT_BROWSER_CROSS_SITE_REQUEST_MANAGER_H_
OLDNEW
« no previous file with comments | « no previous file | content/browser/cross_site_request_manager.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698