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

content / public / browser / render_process_host_priority_client.h [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.

#ifndef CONTENT_PUBLIC_BROWSER_RENDER_PROCESS_HOST_PRIORITY_CLIENT_H_
#define CONTENT_PUBLIC_BROWSER_RENDER_PROCESS_HOST_PRIORITY_CLIENT_H_

namespace content {

#if BUILDFLAG(IS_ANDROID)
enum class ChildProcessImportance;
#endif

// Interface for a client that contributes Priority to a RenderProcessHost.
// Clients can call RenderProcessHost::UpdateClientPriority() when their
// Priority changes.
class RenderProcessHostPriorityClient {
 public:
  // Priority (or on Android, the importance) that a client contributes to a
  // RenderProcessHost. E.g. a RenderProcessHost with a visible client has
  // higher priority / importance than a RenderProcessHost with hidden clients
  // only.
  struct Priority {
    bool is_hidden;
    unsigned int frame_depth;
    bool intersects_viewport;
#if BUILDFLAG(IS_ANDROID)
    ChildProcessImportance importance;
#endif
  };

  virtual Priority GetPriority() = 0;

 protected:
  virtual ~RenderProcessHostPriorityClient() = default;
};

}  // namespace content

#endif  // CONTENT_PUBLIC_BROWSER_RENDER_PROCESS_HOST_PRIORITY_CLIENT_H_