• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  *  Copyright 2019 The WebRTC Project Authors. All rights reserved.
3  *
4  *  Use of this source code is governed by a BSD-style license
5  *  that can be found in the LICENSE file in the root of the source
6  *  tree. An additional intellectual property rights grant can be found
7  *  in the file PATENTS.  All contributing project authors may
8  *  be found in the AUTHORS file in the root of the source tree.
9  */
10 
11 #include "call/adaptation/test/fake_resource.h"
12 
13 #include <algorithm>
14 #include <utility>
15 
16 #include "rtc_base/ref_counted_object.h"
17 
18 namespace webrtc {
19 
20 // static
Create(std::string name)21 rtc::scoped_refptr<FakeResource> FakeResource::Create(std::string name) {
22   return new rtc::RefCountedObject<FakeResource>(name);
23 }
24 
FakeResource(std::string name)25 FakeResource::FakeResource(std::string name)
26     : Resource(), name_(std::move(name)), listener_(nullptr) {}
27 
~FakeResource()28 FakeResource::~FakeResource() {}
29 
SetUsageState(ResourceUsageState usage_state)30 void FakeResource::SetUsageState(ResourceUsageState usage_state) {
31   if (listener_) {
32     listener_->OnResourceUsageStateMeasured(this, usage_state);
33   }
34 }
35 
Name() const36 std::string FakeResource::Name() const {
37   return name_;
38 }
39 
SetResourceListener(ResourceListener * listener)40 void FakeResource::SetResourceListener(ResourceListener* listener) {
41   listener_ = listener;
42 }
43 
44 }  // namespace webrtc
45