summaryrefslogtreecommitdiffstats
path: root/content/browser/transition_request_manager.cc
blob: ab651fed5511c1bd461fd06db8be13115107433e (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
// Copyright 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.

#include "content/browser/transition_request_manager.h"

#include "base/memory/singleton.h"
#include "content/public/browser/browser_thread.h"

namespace content {

bool TransitionRequestManager::HasPendingTransitionRequest(
    int process_id,
    int render_frame_id) {
  DCHECK_CURRENTLY_ON(BrowserThread::IO);

  std::pair<int, int> key(process_id, render_frame_id);
  return (pending_transition_frames_.find(key) !=
          pending_transition_frames_.end());
}

void TransitionRequestManager::SetHasPendingTransitionRequest(
    int process_id,
    int render_frame_id,
    bool has_pending) {
  DCHECK_CURRENTLY_ON(BrowserThread::IO);

  std::pair<int, int> key(process_id, render_frame_id);
  if (has_pending) {
    pending_transition_frames_.insert(key);
  } else {
    pending_transition_frames_.erase(key);
  }
}

TransitionRequestManager::TransitionRequestManager() {
}

TransitionRequestManager::~TransitionRequestManager() {
}

// static
TransitionRequestManager* TransitionRequestManager::GetInstance() {
  return Singleton<TransitionRequestManager>::get();
}

}  // namespace content