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

content / public / browser / media_player_id.cc [blame]

// Copyright 2019 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/public/browser/media_player_id.h"

namespace content {

MediaPlayerId::MediaPlayerId(GlobalRenderFrameHostId frame_routing_id,
                             int delegate_id)
    : frame_routing_id(frame_routing_id), delegate_id(delegate_id) {}

MediaPlayerId MediaPlayerId::CreateMediaPlayerIdForTests() {
  return MediaPlayerId(GlobalRenderFrameHostId(), 0);
}

bool MediaPlayerId::operator==(const MediaPlayerId& other) const {
  return frame_routing_id == other.frame_routing_id &&
         delegate_id == other.delegate_id;
}

bool MediaPlayerId::operator!=(const MediaPlayerId& other) const {
  return frame_routing_id != other.frame_routing_id ||
         delegate_id != other.delegate_id;
}

bool MediaPlayerId::operator<(const MediaPlayerId& other) const {
  if (frame_routing_id == other.frame_routing_id)
    return delegate_id < other.delegate_id;
  return frame_routing_id < other.frame_routing_id;
}

}  // namespace content