Chromium Code Reviews| OLD | NEW |
|---|---|
| (Empty) | |
| 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 | |
| 3 // found in the LICENSE file. | |
| 4 | |
| 5 #ifndef CONTENT_BROWSER_TRANSITION_REQUEST_MANAGER_H_ | |
| 6 #define CONTENT_BROWSER_TRANSITION_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> | |
| 15 struct DefaultSingletonTraits; | |
| 16 | |
| 17 namespace content { | |
| 18 | |
| 19 // TransitionRequestManager is used to handle bookkeeping for transition | |
| 20 // requests and responses between the UI and IO threads. | |
| 21 // | |
| 22 // TransitionRequestManager is a singleton that may be used on any thread. | |
| 23 // | |
| 24 class TransitionRequestManager { | |
| 25 public: | |
| 26 // Returns the singleton instance. | |
| 27 static TransitionRequestManager* GetInstance(); | |
| 28 | |
| 29 // Returns whether the RenderViewHost specified by the given IDs currently | |
|
nasko
2014/06/02 21:59:33
Let's use RenderFrameHost, RenderViewHost doesn't
shatch
2014/06/02 23:40:40
Done.
| |
| 30 // has a pending transition request. If so, we will have to delay the | |
| 31 // response until the embedder resumes the request. | |
| 32 bool HasPendingTransitionRequest(int process_id, int render_view_id); | |
| 33 | |
| 34 // Sets whether the RenderViewHost specified by the given IDs currently has a | |
| 35 // pending transition request. Called by RenderFrameHost on the UI thread. | |
| 36 void SetHasPendingTransitionRequest(int process_id, | |
| 37 int render_view_id, | |
| 38 bool has_pending); | |
| 39 | |
| 40 private: | |
| 41 friend struct DefaultSingletonTraits<TransitionRequestManager>; | |
| 42 typedef std::set<std::pair<int, int> > RenderViewSet; | |
| 43 | |
| 44 TransitionRequestManager(); | |
| 45 ~TransitionRequestManager(); | |
| 46 | |
| 47 // You must acquire this lock before reading or writing any members of this | |
| 48 // class. You must not block while holding this lock. | |
| 49 base::Lock lock_; | |
| 50 | |
| 51 // Set of (render_process_host_id, render_view_id) pairs of all | |
| 52 // RenderViewHosts that have pending transition requests. Used to pass | |
| 53 // information to the CrossSiteResourceHandler without doing a round-trip | |
| 54 // between IO->UI->IO threads. | |
| 55 RenderViewSet pending_transition_views_; | |
| 56 | |
| 57 DISALLOW_COPY_AND_ASSIGN(TransitionRequestManager); | |
| 58 }; | |
| 59 | |
| 60 } // namespace content | |
| 61 | |
| 62 #endif // CONTENT_BROWSER_TRANSITION_REQUEST_MANAGER_H_ | |
| OLD | NEW |