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

content / common / main_frame_counter.cc [blame]

// Copyright 2022 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

#include "content/common/main_frame_counter.h"
#include "base/check_op.h"

namespace content {

// static
size_t MainFrameCounter::main_frame_count_ = 0;

// static
bool MainFrameCounter::has_main_frame() {
  return main_frame_count_ > 0;
}

// static
void MainFrameCounter::IncrementCount() {
  main_frame_count_++;
}

// static
void MainFrameCounter::DecrementCount() {
  // If this check fails, we have miscounted somewhere.
  DCHECK_GT(main_frame_count_, 0u);
  main_frame_count_--;
}

}  // namespace content