summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--cc/base/contiguous_container.h7
-rw-r--r--cc/playback/display_item_list.h7
2 files changed, 8 insertions, 6 deletions
diff --git a/cc/base/contiguous_container.h b/cc/base/contiguous_container.h
index bad1511..af82b7e 100644
--- a/cc/base/contiguous_container.h
+++ b/cc/base/contiguous_container.h
@@ -6,6 +6,7 @@
#define CC_BASE_CONTIGUOUS_CONTAINER_H_
#include <stddef.h>
+#include <utility>
#include "base/logging.h"
#include "base/macros.h"
@@ -164,12 +165,12 @@ class ContiguousContainer : public ContiguousContainerBase {
}
template <class DerivedElementType, typename... Args>
- DerivedElementType& AllocateAndConstruct(const Args&... args) {
+ DerivedElementType& AllocateAndConstruct(Args&&... args) {
static_assert(alignment % ALIGNOF(DerivedElementType) == 0,
"Derived type requires stronger alignment.");
size_t alloc_size = Align(sizeof(DerivedElementType));
- // TODO(enne): This should forward the args.
- return *new (Allocate(alloc_size)) DerivedElementType(args...);
+ return *new (Allocate(alloc_size))
+ DerivedElementType(std::forward<Args>(args)...);
}
void RemoveLast() {
diff --git a/cc/playback/display_item_list.h b/cc/playback/display_item_list.h
index 28a2d2c..bcad05c 100644
--- a/cc/playback/display_item_list.h
+++ b/cc/playback/display_item_list.h
@@ -6,6 +6,7 @@
#define CC_PLAYBACK_DISPLAY_ITEM_LIST_H_
#include <stddef.h>
+#include <utility>
#include "base/gtest_prod_util.h"
#include "base/macros.h"
@@ -70,10 +71,10 @@ class CC_EXPORT DisplayItemList
// type needs to be const, to prevent set-after-processing mistakes.
template <typename DisplayItemType, typename... Args>
const DisplayItemType& CreateAndAppendItem(const gfx::Rect& visual_rect,
- const Args&... args) {
+ Args&&... args) {
visual_rects_.push_back(visual_rect);
- // TODO(enne): This should forward the args.
- auto* item = &items_.AllocateAndConstruct<DisplayItemType>(args...);
+ auto* item = &items_.AllocateAndConstruct<DisplayItemType>(
+ std::forward<Args>(args)...);
approximate_op_count_ += item->ApproximateOpCount();
// TODO(crbug.com/513016): None of the items might individually trigger a
// veto even though they collectively have enough "bad" operations that a