mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-10-08 02:14:43 +00:00
Bug 1623715 - [4.1] Fix LinkedList::length() for a const context. r=froydnj
Differential Revision: https://phabricator.services.mozilla.com/D84543
This commit is contained in:
parent
48d824c5b0
commit
9caff81fa1
@ -450,14 +450,7 @@ MediaController* MediaControlService::ControllerManager::GetMainController()
|
||||
}
|
||||
|
||||
uint64_t MediaControlService::ControllerManager::GetControllersNum() const {
|
||||
size_t length = 0;
|
||||
const auto* element =
|
||||
static_cast<ConstLinkedListControllerPtr>(mControllers.getFirst());
|
||||
while (element) {
|
||||
length++;
|
||||
element = element->getNext();
|
||||
}
|
||||
return length;
|
||||
return mControllers.length();
|
||||
}
|
||||
|
||||
bool MediaControlService::ControllerManager::Contains(
|
||||
|
@ -515,15 +515,7 @@ class LinkedList {
|
||||
/**
|
||||
* Return the length of elements in the list.
|
||||
*/
|
||||
size_t length() const {
|
||||
size_t length = 0;
|
||||
ConstRawType element = getFirst();
|
||||
while (element) {
|
||||
length++;
|
||||
element = element->getNext();
|
||||
}
|
||||
return length;
|
||||
}
|
||||
size_t length() const { return std::distance(begin(), end()); }
|
||||
|
||||
/*
|
||||
* Allow range-based iteration:
|
||||
|
Loading…
Reference in New Issue
Block a user