Chromium Code Reviews| Index: content/browser/transition_request_manager.h |
| diff --git a/content/browser/transition_request_manager.h b/content/browser/transition_request_manager.h |
| new file mode 100644 |
| index 0000000000000000000000000000000000000000..80b80ae32e8dbea0e9207234204969306f40902e |
| --- /dev/null |
| +++ b/content/browser/transition_request_manager.h |
| @@ -0,0 +1,61 @@ |
| +// Copyright (c) 2014 The Chromium Authors. All rights reserved. |
| +// Use of this source code is governed by a BSD-style license that can be |
| +// found in the LICENSE file. |
| + |
| +#ifndef CONTENT_BROWSER_TRANSITION_REQUEST_MANAGER_H_ |
| +#define CONTENT_BROWSER_TRANSITION_REQUEST_MANAGER_H_ |
| + |
| +#include <set> |
| +#include <utility> |
| + |
| +#include "base/basictypes.h" |
| +#include "base/synchronization/lock.h" |
| + |
| +template <typename T> struct DefaultSingletonTraits; |
| + |
| +namespace content { |
| + |
| +// TransitionRequestManager is used to handle bookkeeping for transition |
| +// requests and responses between the UI and IO threads. |
| +// |
| +// TransitionRequestManager is a singleton that may be used on any thread. |
| +// |
| +class TransitionRequestManager { |
| + public: |
| + // Returns the singleton instance. |
| + static TransitionRequestManager* GetInstance(); |
| + |
| + // Returns whether the RenderViewHost specified by the given IDs currently |
| + // has a pending transition request. If so, we will have to delay the |
| + // response until the embedder resumes the request. |
| + bool HasPendingTransitionRequest(int renderer_id, int render_view_id); |
|
nasko
2014/05/28 22:59:00
What is renderer_id? Is it the process id or somet
shatch
2014/05/29 21:41:22
Done.
|
| + |
| + // Sets whether the RenderViewHost specified by the given IDs currently has a |
|
nasko
2014/05/28 22:59:00
Navigations happen through RenderFrameHost these d
shatch
2014/05/29 21:41:22
Changed the comment to reflect being called by the
nasko
2014/06/02 21:59:33
I can see this called only from RenderFrameHostImp
shatch
2014/06/02 23:40:40
Moved everything to RFH per offline discussion.
|
| + // pending transition request. Called by RenderViewHost on the UI thread. |
| + void SetHasPendingTransitionRequest(int renderer_id, |
| + int render_view_id, |
| + bool has_pending); |
| + |
| + private: |
| + friend struct DefaultSingletonTraits<TransitionRequestManager>; |
| + typedef std::set<std::pair<int, int> > RenderViewSet; |
| + |
| + TransitionRequestManager(); |
| + ~TransitionRequestManager(); |
| + |
| + // You must acquire this lock before reading or writing any members of this |
| + // class. You must not block while holding this lock. |
| + base::Lock lock_; |
| + |
| + // Set of (render_process_host_id, render_view_id) pairs of all |
| + // RenderViewHosts that have pending transition requests. Used to pass |
| + // information to the CrossSiteResourceHandler without doing a round-trip |
| + // between IO->UI->IO threads. |
| + RenderViewSet pending_transition_views_; |
| + |
| + DISALLOW_COPY_AND_ASSIGN(TransitionRequestManager); |
| +}; |
| + |
| +} // namespace content |
| + |
| +#endif // CONTENT_BROWSER_TRANSITION_REQUEST_MANAGER_H_ |