diff --git a/starboard/android/shared/audio_track_audio_sink_type.h b/starboard/android/shared/audio_track_audio_sink_type.h index 1d2d8c16bf8e2..9d59c8049e927 100644 --- a/starboard/android/shared/audio_track_audio_sink_type.h +++ b/starboard/android/shared/audio_track_audio_sink_type.h @@ -30,7 +30,6 @@ #include "starboard/audio_sink.h" #include "starboard/common/log.h" #include "starboard/common/mutex.h" -#include "starboard/common/scoped_ptr.h" #include "starboard/configuration.h" #include "starboard/shared/internal_only.h" #include "starboard/shared/starboard/audio_sink/audio_sink_internal.h" diff --git a/starboard/common/BUILD.gn b/starboard/common/BUILD.gn index 3118e3237733b..73f0f4c60d7d8 100644 --- a/starboard/common/BUILD.gn +++ b/starboard/common/BUILD.gn @@ -56,7 +56,6 @@ static_library("common") { "media.h", "metrics/stats_tracker.cc", "metrics/stats_tracker.h", - "move.h", "murmurhash2.cc", "murmurhash2.h", "mutex.cc", @@ -81,7 +80,6 @@ static_library("common") { "reuse_allocator_base.h", "rwlock.cc", "rwlock.h", - "scoped_ptr.h", "semaphore.cc", "semaphore.h", "socket.cc", diff --git a/starboard/common/move.h b/starboard/common/move.h deleted file mode 100644 index a84b2baaad8d7..0000000000000 --- a/starboard/common/move.h +++ /dev/null @@ -1,209 +0,0 @@ -// Copyright (c) 2012 The Chromium Authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -#ifndef STARBOARD_COMMON_MOVE_H_ -#define STARBOARD_COMMON_MOVE_H_ - -// Macro with the boilerplate that makes a type move-only in C++03. -// -// USAGE -// -// This macro should be used instead of DISALLOW_COPY_AND_ASSIGN to create -// a "move-only" type. Unlike DISALLOW_COPY_AND_ASSIGN, this macro should be -// the first line in a class declaration. -// -// A class using this macro must call .Pass() (or somehow be an r-value already) -// before it can be: -// -// * Passed as a function argument -// * Used as the right-hand side of an assignment -// * Returned from a function -// -// Each class will still need to define their own "move constructor" and "move -// operator=" to make this useful. Here's an example of the macro, the move -// constructor, and the move operator= from the scoped_ptr class: -// -// template -// class scoped_ptr { -// MOVE_ONLY_TYPE_FOR_CPP_03(scoped_ptr, RValue) -// public: -// scoped_ptr(RValue& other) : ptr_(other.release()) { } -// scoped_ptr& operator=(RValue& other) { -// swap(other); -// return *this; -// } -// }; -// -// Note that the constructor must NOT be marked explicit. -// -// For consistency, the second parameter to the macro should always be RValue -// unless you have a strong reason to do otherwise. It is only exposed as a -// macro parameter so that the move constructor and move operator= don't look -// like they're using a phantom type. -// -// -// HOW THIS WORKS -// -// For a thorough explanation of this technique, see: -// -// http://en.wikibooks.org/wiki/More_C%2B%2B_Idioms/Move_Constructor -// -// The summary is that we take advantage of 2 properties: -// -// 1) non-const references will not bind to r-values. -// 2) C++ can apply one user-defined conversion when initializing a -// variable. -// -// The first lets us disable the copy constructor and assignment operator -// by declaring private version of them with a non-const reference parameter. -// -// For l-values, direct initialization still fails like in -// DISALLOW_COPY_AND_ASSIGN because the copy constructor and assignment -// operators are private. -// -// For r-values, the situation is different. The copy constructor and -// assignment operator are not viable due to (1), so we are trying to call -// a non-existent constructor and non-existing operator= rather than a private -// one. Since we have not committed an error quite yet, we can provide an -// alternate conversion sequence and a constructor. We add -// -// * a private struct named "RValue" -// * a user-defined conversion "operator RValue()" -// * a "move constructor" and "move operator=" that take the RValue& as -// their sole parameter. -// -// Only r-values will trigger this sequence and execute our "move constructor" -// or "move operator=." L-values will match the private copy constructor and -// operator= first giving a "private in this context" error. This combination -// gives us a move-only type. -// -// For signaling a destructive transfer of data from an l-value, we provide a -// method named Pass() which creates an r-value for the current instance -// triggering the move constructor or move operator=. -// -// Other ways to get r-values is to use the result of an expression like a -// function call. -// -// Here's an example with comments explaining what gets triggered where: -// -// class Foo { -// MOVE_ONLY_TYPE_FOR_CPP_03(Foo, RValue); -// -// public: -// ... API ... -// Foo(RValue other); // Move constructor. -// Foo& operator=(RValue rhs); // Move operator= -// }; -// -// Foo MakeFoo(); // Function that returns a Foo. -// -// Foo f; -// Foo f_copy(f); // ERROR: Foo(Foo&) is private in this context. -// Foo f_assign; -// f_assign = f; // ERROR: operator=(Foo&) is private in this context. -// -// -// Foo f(MakeFoo()); // R-value so alternate conversion executed. -// Foo f_copy(f.Pass()); // R-value so alternate conversion executed. -// f = f_copy.Pass(); // R-value so alternate conversion executed. -// -// -// IMPLEMENTATION SUBTLETIES WITH RValue -// -// The RValue struct is just a container for a pointer back to the original -// object. It should only ever be created as a temporary, and no external -// class should ever declare it or use it in a parameter. -// -// It is tempting to want to use the RValue type in function parameters, but -// excluding the limited usage here for the move constructor and move -// operator=, doing so would mean that the function could take both r-values -// and l-values equally which is unexpected. See COMPARED To Boost.Move for -// more details. -// -// An alternate, and incorrect, implementation of the RValue class used by -// Boost.Move makes RValue a fieldless child of the move-only type. RValue& -// is then used in place of RValue in the various operators. The RValue& is -// "created" by doing *reinterpret_cast(this). This has the appeal -// of never creating a temporary RValue struct even with optimizations -// disabled. Also, by virtue of inheritance you can treat the RValue -// reference as if it were the move-only type itself. Unfortunately, -// using the result of this reinterpret_cast<> is actually undefined behavior -// due to C++98 5.2.10.7. In certain compilers (eg., NaCl) the optimizer -// will generate non-working code. -// -// In optimized builds, both implementations generate the same assembly so we -// choose the one that adheres to the standard. -// -// -// COMPARED TO C++11 -// -// In C++11, you would implement this functionality using an r-value reference -// and our .Pass() method would be replaced with a call to std::move(). -// -// This emulation also has a deficiency where it uses up the single -// user-defined conversion allowed by C++ during initialization. This can -// cause problems in some API edge cases. For instance, in scoped_ptr, it is -// impossible to make an function "void Foo(scoped_ptr p)" accept a -// value of type scoped_ptr even if you add a constructor to -// scoped_ptr<> that would make it look like it should work. C++11 does not -// have this deficiency. -// -// -// COMPARED TO Boost.Move -// -// Our implementation similar to Boost.Move, but we keep the RValue struct -// private to the move-only type, and we don't use the reinterpret_cast<> hack. -// -// In Boost.Move, RValue is the boost::rv<> template. This type can be used -// when writing APIs like: -// -// void MyFunc(boost::rv& f) -// -// that can take advantage of rv<> to avoid extra copies of a type. However you -// would still be able to call this version of MyFunc with an l-value: -// -// Foo f; -// MyFunc(f); // Uh oh, we probably just destroyed |f| w/o calling Pass(). -// -// unless someone is very careful to also declare a parallel override like: -// -// void MyFunc(const Foo& f) -// -// that would catch the l-values first. This was declared unsafe in C++11 and -// a C++11 compiler will explicitly fail MyFunc(f). Unfortunately, we cannot -// ensure this in C++03. -// -// Since we have no need for writing such APIs yet, our implementation keeps -// RValue private and uses a .Pass() method to do the conversion instead of -// trying to write a version of "std::move()." Writing an API like std::move() -// would require the RValue structs to be public. -// -// -// CAVEATS -// -// If you include a move-only type as a field inside a class that does not -// explicitly declare a copy constructor, the containing class's implicit -// copy constructor will change from Containing(const Containing&) to -// Containing(Containing&). This can cause some unexpected errors. -// -// http://llvm.org/bugs/show_bug.cgi?id=11528 -// -// The workaround is to explicitly declare your copy constructor. - -#define MOVE_ONLY_TYPE_FOR_CPP_03(type, rvalue_type) \ - private: \ - struct rvalue_type { \ - rvalue_type(type* object) : object(object) {} \ - type* object; \ - }; \ - type(type&); \ - void operator=(type&); \ - \ - public: \ - operator rvalue_type() { return rvalue_type(this); } \ - type Pass() { return type(rvalue_type(this)); } \ - \ - private: - -#endif // STARBOARD_COMMON_MOVE_H_ diff --git a/starboard/common/scoped_ptr.h b/starboard/common/scoped_ptr.h deleted file mode 100644 index 7d85d6fc51e44..0000000000000 --- a/starboard/common/scoped_ptr.h +++ /dev/null @@ -1,513 +0,0 @@ -// Copyright 2023 The Cobalt Authors. All Rights Reserved. -// Copyright (c) 2012 The Chromium Authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -// Scopers help you manage ownership of a pointer, helping you easily manage the -// a pointer within a scope, and automatically destroying the pointer at the -// end of a scope. There are two main classes you will use, which correspond -// to the operators new/delete and new[]/delete[]. -// -// Example usage (scoped_ptr): -// { -// scoped_ptr foo(new Foo("whee")); -// } // foo goes out of scope, releasing the pointer with it. -// -// { -// scoped_ptr foo; // No pointer managed. -// foo.reset(new Foo("whee")); // Now a pointer is managed. -// foo.reset(new Foo("whee2")); // Foo("whee") was destroyed. -// foo.reset(new Foo("whee3")); // Foo("whee2") was destroyed. -// foo->Method(); // Foo::Method() called. -// foo.get()->Method(); // Foo::Method() called. -// SomeFunc(foo.release()); // SomeFunc takes ownership, foo no longer -// // manages a pointer. -// foo.reset(new Foo("whee4")); // foo manages a pointer again. -// foo.reset(); // Foo("whee4") destroyed, foo no longer -// // manages a pointer. -// } // foo wasn't managing a pointer, so nothing was destroyed. -// -// Example usage (scoped_array): -// { -// scoped_array foo(new Foo[100]); -// foo.get()->Method(); // Foo::Method on the 0th element. -// foo[10].Method(); // Foo::Method on the 10th element. -// } -// -// These scopers also implement part of the functionality of C++11 unique_ptr -// in that they are "movable but not copyable." You can use the scopers in -// the parameter and return types of functions to signify ownership transfer -// in to and out of a function. When calling a function that has a scoper -// as the argument type, it must be called with the result of an analogous -// scoper's Pass() function or another function that generates a temporary; -// passing by copy will NOT work. Here is an example using scoped_ptr: -// -// void TakesOwnership(scoped_ptr arg) { -// // Do something with arg -// } -// scoped_ptr CreateFoo() { -// // No need for calling Pass() because we are constructing a temporary -// // for the return value. -// return scoped_ptr(new Foo("new")); -// } -// scoped_ptr PassThru(scoped_ptr arg) { -// return arg.Pass(); -// } -// -// { -// scoped_ptr ptr(new Foo("yay")); // ptr manages Foo("yay"). -// TakesOwnership(ptr.Pass()); // ptr no longer owns Foo("yay"). -// scoped_ptr ptr2 = CreateFoo(); // ptr2 owns the return Foo. -// scoped_ptr ptr3 = // ptr3 now owns what was in ptr2. -// PassThru(ptr2.Pass()); // ptr2 is correspondingly NULL. -// } -// -// Notice that if you do not call Pass() when returning from PassThru(), or -// when invoking TakesOwnership(), the code will not compile because scopers -// are not copyable; they only implement move semantics which require calling -// the Pass() function to signify a destructive transfer of state. CreateFoo() -// is different though because we are constructing a temporary on the return -// line and thus can avoid needing to call Pass(). -// -// Pass() properly handles upcast in assignment, i.e. you can assign -// scoped_ptr to scoped_ptr: -// -// scoped_ptr foo(new Foo()); -// scoped_ptr parent = foo.Pass(); -// -// PassAs<>() should be used to upcast return value in return statement: -// -// scoped_ptr CreateFoo() { -// scoped_ptr result(new FooChild()); -// return result.PassAs(); -// } -// -// Note that PassAs<>() is implemented only for scoped_ptr, but not for -// scoped_array. This is because casting array pointers may not be safe. - -#ifndef STARBOARD_COMMON_SCOPED_PTR_H_ -#define STARBOARD_COMMON_SCOPED_PTR_H_ - -// This is an implementation designed to match the anticipated future TR2 -// implementation of the scoped_ptr class, and its closely-related brethren, -// scoped_array, scoped_ptr_malloc. - -#include -#include -#include - -#include "starboard/common/log.h" -#include "starboard/common/move.h" -#include "starboard/memory.h" -#include "starboard/types.h" - -namespace starboard { - -// A scoped_ptr is like a T*, except that the destructor of scoped_ptr -// automatically deletes the pointer it holds (if any). -// That is, scoped_ptr owns the T object that it points to. -// Like a T*, a scoped_ptr may hold either NULL or a pointer to a T object. -// Also like T*, scoped_ptr is thread-compatible, and once you -// dereference it, you get the thread safety guarantees of T. -// -// The size of a scoped_ptr is small: -// sizeof(scoped_ptr) == sizeof(C*) -template -class scoped_ptr { - MOVE_ONLY_TYPE_FOR_CPP_03(scoped_ptr, RValue) - - public: - // The element type - typedef C element_type; - - // Constructor. Defaults to initializing with NULL. - // There is no way to create an uninitialized scoped_ptr. - // The input parameter must be allocated with new. - explicit scoped_ptr(C* p = NULL) : ptr_(p) {} - -// The GHS compiler always chooses this copy constructor over the next one, -// so disable this to promote the more important and frequently used constr. -#if !defined(COMPILER_GHS) - // Constructor. Allows construction from a scoped_ptr rvalue for a - // convertible type. - template - scoped_ptr(scoped_ptr other) // NOLINT(runtime/explicit) - : ptr_(other.release()) {} -#endif - - scoped_ptr(scoped_ptr&& other) : ptr_(other.release()) {} - - // Constructor. Move constructor for C++03 move emulation of this type. - scoped_ptr(RValue rvalue) // NOLINT(runtime/explicit) - : ptr_(rvalue.object->release()) {} - - // Destructor. If there is a C object, delete it. - // We don't need to test ptr_ == NULL because C++ does that for us. - ~scoped_ptr() { - enum { type_must_be_complete = sizeof(C) }; - delete ptr_; - } - - // operator=. Allows assignment from a scoped_ptr rvalue for a convertible - // type. - template - scoped_ptr& operator=(scoped_ptr rhs) { - reset(rhs.release()); - return *this; - } - - // operator=. Move operator= for C++03 move emulation of this type. - scoped_ptr& operator=(RValue rhs) { - swap(*rhs->object); - return *this; - } - - // Reset. Deletes the current owned object, if any. - // Then takes ownership of a new object, if given. - // this->reset(this->get()) works. - void reset(C* p = NULL) { - if (p != ptr_) { - enum { type_must_be_complete = sizeof(C) }; - delete ptr_; - ptr_ = p; - } - } - - // Accessors to get the owned object. - // operator* and operator-> will SB_DCHECK() if there is no current object. - C& operator*() const { - SB_DCHECK(ptr_ != NULL); - return *ptr_; - } - C* operator->() const { - SB_DCHECK(ptr_ != NULL); - return ptr_; - } - C* get() const { return ptr_; } - - // Allow scoped_ptr to be used in boolean expressions, but not - // implicitly convertible to a real bool (which is dangerous). - typedef C* scoped_ptr::*Testable; - operator Testable() const { return ptr_ ? &scoped_ptr::ptr_ : NULL; } - - // Comparison operators. - // These return whether two scoped_ptr refer to the same object, not just to - // two different but equal objects. - bool operator==(C* p) const { return ptr_ == p; } - bool operator!=(C* p) const { return ptr_ != p; } - - // Swap two scoped pointers. - void swap(scoped_ptr& p2) { - C* tmp = ptr_; - ptr_ = p2.ptr_; - p2.ptr_ = tmp; - } - - // Release a pointer. - // The return value is the current pointer held by this object. - // If this object holds a NULL pointer, the return value is NULL. - // After this operation, this object will hold a NULL pointer, - // and will not own the object any more. - C* release() { - C* retVal = ptr_; - ptr_ = NULL; - return retVal; - } - - template - scoped_ptr PassAs() { - return scoped_ptr(release()); - } - - private: - C* ptr_; - - // Forbid comparison of scoped_ptr types. If C2 != C, it totally doesn't - // make sense, and if C2 == C, it still doesn't make sense because you should - // never have the same object owned by two different scoped_ptrs. - template - bool operator==(scoped_ptr const& p2) const; - template - bool operator!=(scoped_ptr const& p2) const; -}; - -// Free functions -template -void swap(scoped_ptr& p1, scoped_ptr& p2) { - p1.swap(p2); -} - -template -bool operator==(C* p1, const scoped_ptr& p2) { - return p1 == p2.get(); -} - -template -bool operator!=(C* p1, const scoped_ptr& p2) { - return p1 != p2.get(); -} - -// scoped_array is like scoped_ptr, except that the caller must allocate -// with new [] and the destructor deletes objects with delete []. -// -// As with scoped_ptr, a scoped_array either points to an object -// or is NULL. A scoped_array owns the object that it points to. -// scoped_array is thread-compatible, and once you index into it, -// the returned objects have only the thread safety guarantees of T. -// -// Size: sizeof(scoped_array) == sizeof(C*) -template -class scoped_array { - MOVE_ONLY_TYPE_FOR_CPP_03(scoped_array, RValue) - - public: - // The element type - typedef C element_type; - - // Constructor. Defaults to initializing with NULL. - // There is no way to create an uninitialized scoped_array. - // The input parameter must be allocated with new []. - explicit scoped_array(C* p = NULL) : array_(p) {} - - // Constructor. Move constructor for C++03 move emulation of this type. - scoped_array(RValue rvalue) // NOLINT(runtime/explicit) - : array_(rvalue.object->release()) {} - - // Destructor. If there is a C object, delete it. - // We don't need to test ptr_ == NULL because C++ does that for us. - ~scoped_array() { - enum { type_must_be_complete = sizeof(C) }; - delete[] array_; - } - - // operator=. Move operator= for C++03 move emulation of this type. - scoped_array& operator=(RValue rhs) { - swap(*rhs.object); - return *this; - } - - // Reset. Deletes the current owned object, if any. - // Then takes ownership of a new object, if given. - // this->reset(this->get()) works. - void reset(C* p = NULL) { - if (p != array_) { - enum { type_must_be_complete = sizeof(C) }; - delete[] array_; - array_ = p; - } - } - - // Get one element of the current object. - // Will SB_DCHECK() if there is no current object, or index i is negative. - C& operator[](ptrdiff_t i) const { - SB_DCHECK(i >= 0); - SB_DCHECK(array_ != NULL); - return array_[i]; - } - - // Get a pointer to the zeroth element of the current object. - // If there is no current object, return NULL. - C* get() const { return array_; } - - // Allow scoped_array to be used in boolean expressions, but not - // implicitly convertible to a real bool (which is dangerous). - typedef C* scoped_array::*Testable; - operator Testable() const { return array_ ? &scoped_array::array_ : NULL; } - - // Comparison operators. - // These return whether two scoped_array refer to the same object, not just to - // two different but equal objects. - bool operator==(C* p) const { return array_ == p; } - bool operator!=(C* p) const { return array_ != p; } - - // Swap two scoped arrays. - void swap(scoped_array& p2) { - C* tmp = array_; - array_ = p2.array_; - p2.array_ = tmp; - } - - // Release an array. - // The return value is the current pointer held by this object. - // If this object holds a NULL pointer, the return value is NULL. - // After this operation, this object will hold a NULL pointer, - // and will not own the object any more. - C* release() { - C* retVal = array_; - array_ = NULL; - return retVal; - } - - private: - C* array_; - - // Forbid comparison of different scoped_array types. - template - bool operator==(scoped_array const& p2) const; - template - bool operator!=(scoped_array const& p2) const; -}; - -// Free functions -template -void swap(scoped_array& p1, scoped_array& p2) { - p1.swap(p2); -} - -template -bool operator==(C* p1, const scoped_array& p2) { - return p1 == p2.get(); -} - -template -bool operator!=(C* p1, const scoped_array& p2) { - return p1 != p2.get(); -} - -// This class wraps the memory deallocation function in a class that can be -// passed as a template argument to scoped_ptr_malloc below. -class ScopedPtrMallocFree { - public: - inline void operator()(void* x) const { free(x); } -}; - -// This class wraps the memory deallocation function in a class that -// can be passed as a template argument to scoped_ptr_malloc below. -class ScopedPtrMallocFreeAligned { - public: - inline void operator()(void* x) const { free(x); } -}; - -// scoped_ptr_malloc<> is similar to scoped_ptr<>, but it accepts a -// second template argument, the functor used to free the object. - -template -class scoped_ptr_malloc { - MOVE_ONLY_TYPE_FOR_CPP_03(scoped_ptr_malloc, RValue) - - public: - // The element type - typedef C element_type; - - // Constructor. Defaults to initializing with NULL. - // There is no way to create an uninitialized scoped_ptr. - // The input parameter must be allocated with an allocator that matches the - // Free functor. For the default Free functor, this is malloc, calloc, or - // realloc. - explicit scoped_ptr_malloc(C* p = NULL) : ptr_(p) {} - - // Constructor. Move constructor for C++03 move emulation of this type. - scoped_ptr_malloc(RValue rvalue) // NOLINT(runtime/explicit) - : ptr_(rvalue.object->release()) {} - - // Destructor. If there is a C object, call the Free functor. - ~scoped_ptr_malloc() { reset(); } - - // operator=. Move operator= for C++03 move emulation of this type. - scoped_ptr_malloc& operator=(RValue rhs) { - swap(*rhs.object); - return *this; - } - - // Reset. Calls the Free functor on the current owned object, if any. - // Then takes ownership of a new object, if given. - // this->reset(this->get()) works. - void reset(C* p = NULL) { - if (ptr_ != p) { - FreeProc free_proc; - free_proc(ptr_); - ptr_ = p; - } - } - - // Get the current object. - // operator* and operator-> will cause an SB_DCHECK() failure if there is - // no current object. - C& operator*() const { - SB_DCHECK(ptr_ != NULL); - return *ptr_; - } - - C* operator->() const { - SB_DCHECK(ptr_ != NULL); - return ptr_; - } - - C* get() const { return ptr_; } - - // Allow scoped_ptr_malloc to be used in boolean expressions, but not - // implicitly convertible to a real bool (which is dangerous). - typedef C* scoped_ptr_malloc::*Testable; - operator Testable() const { return ptr_ ? &scoped_ptr_malloc::ptr_ : NULL; } - - // Comparison operators. - // These return whether a scoped_ptr_malloc and a plain pointer refer - // to the same object, not just to two different but equal objects. - // For compatibility with the boost-derived implementation, these - // take non-const arguments. - bool operator==(C* p) const { return ptr_ == p; } - - bool operator!=(C* p) const { return ptr_ != p; } - - // Swap two scoped pointers. - void swap(scoped_ptr_malloc& b) { - C* tmp = b.ptr_; - b.ptr_ = ptr_; - ptr_ = tmp; - } - - // Release a pointer. - // The return value is the current pointer held by this object. - // If this object holds a NULL pointer, the return value is NULL. - // After this operation, this object will hold a NULL pointer, - // and will not own the object any more. - C* release() { - C* tmp = ptr_; - ptr_ = NULL; - return tmp; - } - - private: - C* ptr_; - - // no reason to use these: each scoped_ptr_malloc should have its own object - template - bool operator==(scoped_ptr_malloc const& p) const; - template - bool operator!=(scoped_ptr_malloc const& p) const; -}; - -template -inline void swap(scoped_ptr_malloc& a, scoped_ptr_malloc& b) { - a.swap(b); -} - -template -inline bool operator==(C* p, const scoped_ptr_malloc& b) { - return p == b.get(); -} - -template -inline bool operator!=(C* p, const scoped_ptr_malloc& b) { - return p != b.get(); -} - -// A function to convert T* into scoped_ptr -// Doing e.g. make_scoped_ptr(new FooBarBaz(arg)) is a shorter notation -// for scoped_ptr >(new FooBarBaz(arg)) -template -scoped_ptr make_scoped_ptr(T* ptr) { - return scoped_ptr(ptr); -} - -#ifdef DEPRECATED_SCOPED_PTR -template -using unique_ptr_alias = std::unique_ptr; -#else -template -using unique_ptr_alias = scoped_ptr; -#endif - -} // namespace starboard - -#endif // STARBOARD_COMMON_SCOPED_PTR_H_ diff --git a/starboard/common/thread.h b/starboard/common/thread.h index 79728d4e94d95..1ac5a19d47c3c 100644 --- a/starboard/common/thread.h +++ b/starboard/common/thread.h @@ -21,7 +21,6 @@ #include #include -#include "starboard/common/scoped_ptr.h" #include "starboard/configuration.h" #include "starboard/thread.h" #include "starboard/types.h" diff --git a/starboard/elf_loader/dynamic_section_test.cc b/starboard/elf_loader/dynamic_section_test.cc index 455c062196596..e0483cd6927d2 100644 --- a/starboard/elf_loader/dynamic_section_test.cc +++ b/starboard/elf_loader/dynamic_section_test.cc @@ -14,7 +14,6 @@ #include "starboard/elf_loader/dynamic_section.h" -#include "starboard/common/scoped_ptr.h" #include "starboard/string.h" #include "testing/gtest/include/gtest/gtest.h" diff --git a/starboard/elf_loader/elf_loader_sys_impl.h b/starboard/elf_loader/elf_loader_sys_impl.h index b004a54ecd5cd..47ff81b295749 100644 --- a/starboard/elf_loader/elf_loader_sys_impl.h +++ b/starboard/elf_loader/elf_loader_sys_impl.h @@ -15,8 +15,6 @@ #ifndef STARBOARD_ELF_LOADER_ELF_LOADER_SYS_IMPL_H_ #define STARBOARD_ELF_LOADER_ELF_LOADER_SYS_IMPL_H_ -#include "starboard/common/scoped_ptr.h" - namespace starboard { namespace elf_loader { diff --git a/starboard/elf_loader/elf_loader_test.cc b/starboard/elf_loader/elf_loader_test.cc index 081b96bb801c0..2fbfdf27c84eb 100644 --- a/starboard/elf_loader/elf_loader_test.cc +++ b/starboard/elf_loader/elf_loader_test.cc @@ -14,7 +14,6 @@ #include "starboard/elf_loader/elf_loader_impl.h" -#include "starboard/common/scoped_ptr.h" #include "testing/gtest/include/gtest/gtest.h" namespace starboard { diff --git a/starboard/loader_app/memory_tracker_thread.cc b/starboard/loader_app/memory_tracker_thread.cc index d2c37815fd41a..be70f692b7ec3 100644 --- a/starboard/loader_app/memory_tracker_thread.cc +++ b/starboard/loader_app/memory_tracker_thread.cc @@ -14,6 +14,8 @@ #include "starboard/loader_app/memory_tracker_thread.h" +#include "starboard/common/log.h" + namespace starboard { namespace loader_app { diff --git a/starboard/nplb/align_test.cc b/starboard/nplb/align_test.cc index 35bfa1c8e80f4..07208da543c73 100644 --- a/starboard/nplb/align_test.cc +++ b/starboard/nplb/align_test.cc @@ -12,7 +12,6 @@ // See the License for the specific language governing permissions and // limitations under the License. -#include "starboard/common/scoped_ptr.h" #include "starboard/configuration.h" #include "testing/gtest/include/gtest/gtest.h" diff --git a/starboard/shared/ffmpeg/ffmpeg_dynamic_load_dispatch_impl.cc b/starboard/shared/ffmpeg/ffmpeg_dynamic_load_dispatch_impl.cc index 3ccb481ea22ad..930cda6043452 100644 --- a/starboard/shared/ffmpeg/ffmpeg_dynamic_load_dispatch_impl.cc +++ b/starboard/shared/ffmpeg/ffmpeg_dynamic_load_dispatch_impl.cc @@ -21,7 +21,6 @@ #include #include "starboard/common/log.h" -#include "starboard/common/scoped_ptr.h" #include "starboard/common/string.h" #include "starboard/shared/ffmpeg/ffmpeg_dispatch.h" #include "starboard/shared/starboard/lazy_initialization_internal.h" diff --git a/starboard/shared/ffmpeg/ffmpeg_linked_dispatch_impl.cc b/starboard/shared/ffmpeg/ffmpeg_linked_dispatch_impl.cc index 249d2af6813e6..bf54c2331d919 100644 --- a/starboard/shared/ffmpeg/ffmpeg_linked_dispatch_impl.cc +++ b/starboard/shared/ffmpeg/ffmpeg_linked_dispatch_impl.cc @@ -24,7 +24,6 @@ #include "starboard/common/log.h" #include "starboard/common/once.h" -#include "starboard/common/scoped_ptr.h" #include "starboard/common/string.h" #include "starboard/shared/ffmpeg/ffmpeg_common.h" #include "starboard/shared/starboard/lazy_initialization_internal.h" diff --git a/starboard/shared/libaom/aom_video_decoder.cc b/starboard/shared/libaom/aom_video_decoder.cc index 306f52e0e5ced..60b2f43add1be 100644 --- a/starboard/shared/libaom/aom_video_decoder.cc +++ b/starboard/shared/libaom/aom_video_decoder.cc @@ -102,7 +102,7 @@ void VideoDecoder::Reset() { SB_DCHECK(BelongsToCurrentThread()); if (decoder_thread_) { - decoder_thread_->job_queue()->Schedule( + decoder_thread_->job_queue()->ScheduleAndWait( std::bind(&VideoDecoder::TeardownCodec, this)); // Join the thread to ensure that all callbacks in process are finished. diff --git a/starboard/shared/libaom/aom_video_decoder.h b/starboard/shared/libaom/aom_video_decoder.h index e5e344725735a..a426a42ce8ad4 100644 --- a/starboard/shared/libaom/aom_video_decoder.h +++ b/starboard/shared/libaom/aom_video_decoder.h @@ -17,6 +17,7 @@ #include +#include #include #include @@ -77,13 +78,13 @@ class VideoDecoder : public starboard::player::filter::VideoDecoder, int current_frame_width_; int current_frame_height_; - scoped_ptr context_; + std::unique_ptr context_; bool stream_ended_; bool error_occurred_; // Working thread to avoid lengthy decoding work block the player thread. - scoped_ptr decoder_thread_; + std::unique_ptr decoder_thread_; // Decode-to-texture related state. SbPlayerOutputMode output_mode_; diff --git a/starboard/shared/starboard/application.h b/starboard/shared/starboard/application.h index 7b33a0dd2d72e..ab7892fa7693f 100644 --- a/starboard/shared/starboard/application.h +++ b/starboard/shared/starboard/application.h @@ -27,7 +27,6 @@ #include "starboard/common/condition_variable.h" #include "starboard/common/log.h" #include "starboard/common/ref_counted.h" -#include "starboard/common/scoped_ptr.h" #include "starboard/common/time.h" #include "starboard/event.h" #include "starboard/player.h" diff --git a/starboard/shared/starboard/net_log.h b/starboard/shared/starboard/net_log.h index 91f479104b861..2eb56053cb041 100644 --- a/starboard/shared/starboard/net_log.h +++ b/starboard/shared/starboard/net_log.h @@ -34,7 +34,6 @@ #ifndef STARBOARD_SHARED_STARBOARD_NET_LOG_H_ #define STARBOARD_SHARED_STARBOARD_NET_LOG_H_ -#include "starboard/common/scoped_ptr.h" #include "starboard/common/socket.h" namespace starboard { diff --git a/starboard/shared/starboard/player/decoded_audio_internal.h b/starboard/shared/starboard/player/decoded_audio_internal.h index aa25e7b124141..3e39f38a7f13a 100644 --- a/starboard/shared/starboard/player/decoded_audio_internal.h +++ b/starboard/shared/starboard/player/decoded_audio_internal.h @@ -18,7 +18,6 @@ #include #include "starboard/common/ref_counted.h" -#include "starboard/common/scoped_ptr.h" #include "starboard/media.h" #include "starboard/shared/internal_only.h" #include "starboard/shared/starboard/player/buffer_internal.h" diff --git a/starboard/shared/starboard/player/filter/adaptive_audio_decoder_internal.h b/starboard/shared/starboard/player/filter/adaptive_audio_decoder_internal.h index 70232de0fca33..3190c228662a2 100644 --- a/starboard/shared/starboard/player/filter/adaptive_audio_decoder_internal.h +++ b/starboard/shared/starboard/player/filter/adaptive_audio_decoder_internal.h @@ -19,7 +19,6 @@ #include #include "starboard/common/ref_counted.h" -#include "starboard/common/scoped_ptr.h" #include "starboard/media.h" #include "starboard/shared/internal_only.h" #include "starboard/shared/starboard/media/media_util.h" @@ -36,7 +35,7 @@ namespace filter { class AdaptiveAudioDecoder : public AudioDecoder, private JobQueue::JobOwner { public: - typedef std::function( + typedef std::function( const media::AudioStreamInfo& audio_stream_info, SbDrmSystem drm_system)> AudioDecoderCreator; @@ -86,7 +85,7 @@ class AdaptiveAudioDecoder : public AudioDecoder, private JobQueue::JobOwner { OutputCB output_cb_ = nullptr; ErrorCB error_cb_ = nullptr; - unique_ptr_alias audio_decoder_; + std::unique_ptr audio_decoder_; std::unique_ptr resampler_; std::unique_ptr channel_mixer_; InputBuffers pending_input_buffers_; diff --git a/starboard/shared/starboard/player/filter/audio_channel_layout_mixer.h b/starboard/shared/starboard/player/filter/audio_channel_layout_mixer.h index bd75d64fb5f43..f05db5932da9d 100644 --- a/starboard/shared/starboard/player/filter/audio_channel_layout_mixer.h +++ b/starboard/shared/starboard/player/filter/audio_channel_layout_mixer.h @@ -19,7 +19,6 @@ #include #include "starboard/common/ref_counted.h" -#include "starboard/common/scoped_ptr.h" #include "starboard/media.h" #include "starboard/shared/internal_only.h" #include "starboard/shared/starboard/player/decoded_audio_internal.h" diff --git a/starboard/shared/starboard/player/filter/audio_frame_tracker.h b/starboard/shared/starboard/player/filter/audio_frame_tracker.h index 4582a7421408d..762ae5bb1d066 100644 --- a/starboard/shared/starboard/player/filter/audio_frame_tracker.h +++ b/starboard/shared/starboard/player/filter/audio_frame_tracker.h @@ -18,7 +18,6 @@ #include #include "starboard/common/log.h" -#include "starboard/common/scoped_ptr.h" #include "starboard/media.h" #include "starboard/shared/internal_only.h" #include "starboard/shared/starboard/thread_checker.h" diff --git a/starboard/shared/starboard/player/filter/audio_renderer_internal_pcm.cc b/starboard/shared/starboard/player/filter/audio_renderer_internal_pcm.cc index 4b99d91765e79..8de8013ae8dac 100644 --- a/starboard/shared/starboard/player/filter/audio_renderer_internal_pcm.cc +++ b/starboard/shared/starboard/player/filter/audio_renderer_internal_pcm.cc @@ -68,8 +68,8 @@ SbMediaAudioSampleType GetSinkAudioSampleType( } // namespace AudioRendererPcm::AudioRendererPcm( - unique_ptr_alias decoder, - unique_ptr_alias audio_renderer_sink, + std::unique_ptr decoder, + std::unique_ptr audio_renderer_sink, const media::AudioStreamInfo& audio_stream_info, int max_cached_frames, int min_frames_per_append) diff --git a/starboard/shared/starboard/player/filter/audio_renderer_internal_pcm.h b/starboard/shared/starboard/player/filter/audio_renderer_internal_pcm.h index 6d881264de0a2..6a424b4c20f7c 100644 --- a/starboard/shared/starboard/player/filter/audio_renderer_internal_pcm.h +++ b/starboard/shared/starboard/player/filter/audio_renderer_internal_pcm.h @@ -24,7 +24,6 @@ #include "starboard/common/log.h" #include "starboard/common/mutex.h" #include "starboard/common/optional.h" -#include "starboard/common/scoped_ptr.h" #include "starboard/media.h" #include "starboard/shared/internal_only.h" #include "starboard/shared/starboard/media/media_util.h" @@ -67,8 +66,8 @@ class AudioRendererPcm : public AudioRenderer, // longer accept more data. // |min_frames_per_append| is the min number of frames that the audio renderer // tries to append to the sink buffer at once. - AudioRendererPcm(unique_ptr_alias decoder, - unique_ptr_alias audio_renderer_sink, + AudioRendererPcm(std::unique_ptr decoder, + std::unique_ptr audio_renderer_sink, const media::AudioStreamInfo& audio_stream_info, int max_cached_frames, int min_frames_per_append); @@ -129,7 +128,7 @@ class AudioRendererPcm : public AudioRenderer, int64_t total_frames_consumed_by_sink_ = 0; int32_t frames_consumed_by_sink_since_last_get_current_time_; - unique_ptr_alias decoder_; + std::unique_ptr decoder_; int64_t frames_consumed_set_at_; double playback_rate_ = 1.0; @@ -182,7 +181,7 @@ class AudioRendererPcm : public AudioRenderer, // and can thus avoid doing a full reset. bool first_input_written_ = false; - unique_ptr_alias audio_renderer_sink_; + std::unique_ptr audio_renderer_sink_; bool is_eos_reached_on_sink_thread_ = false; bool is_playing_on_sink_thread_ = false; int64_t frames_in_buffer_on_sink_thread_ = 0; diff --git a/starboard/shared/starboard/player/filter/audio_resampler.h b/starboard/shared/starboard/player/filter/audio_resampler.h index 3dded5a9791a1..fc161c15b1d5c 100644 --- a/starboard/shared/starboard/player/filter/audio_resampler.h +++ b/starboard/shared/starboard/player/filter/audio_resampler.h @@ -18,7 +18,6 @@ #include #include "starboard/common/ref_counted.h" -#include "starboard/common/scoped_ptr.h" #include "starboard/media.h" #include "starboard/shared/internal_only.h" #include "starboard/shared/starboard/player/decoded_audio_internal.h" diff --git a/starboard/shared/starboard/player/filter/audio_time_stretcher.h b/starboard/shared/starboard/player/filter/audio_time_stretcher.h index 29e79220f1079..13956389afb37 100644 --- a/starboard/shared/starboard/player/filter/audio_time_stretcher.h +++ b/starboard/shared/starboard/player/filter/audio_time_stretcher.h @@ -38,7 +38,6 @@ #include #include "starboard/common/ref_counted.h" -#include "starboard/common/scoped_ptr.h" #include "starboard/shared/internal_only.h" #include "starboard/shared/starboard/player/decoded_audio_internal.h" #include "starboard/shared/starboard/player/filter/decoded_audio_queue.h" diff --git a/starboard/shared/starboard/player/filter/cpu_video_frame.h b/starboard/shared/starboard/player/filter/cpu_video_frame.h index b31f9068d03a2..ba3c30f05447b 100644 --- a/starboard/shared/starboard/player/filter/cpu_video_frame.h +++ b/starboard/shared/starboard/player/filter/cpu_video_frame.h @@ -19,7 +19,6 @@ #include #include "starboard/common/ref_counted.h" -#include "starboard/common/scoped_ptr.h" #include "starboard/configuration.h" #include "starboard/media.h" #include "starboard/shared/internal_only.h" diff --git a/starboard/shared/starboard/player/filter/filter_based_player_worker_handler.cc b/starboard/shared/starboard/player/filter/filter_based_player_worker_handler.cc index 8de626124c6aa..f55a639d2448e 100644 --- a/starboard/shared/starboard/player/filter/filter_based_player_worker_handler.cc +++ b/starboard/shared/starboard/player/filter/filter_based_player_worker_handler.cc @@ -14,6 +14,7 @@ #include "starboard/shared/starboard/player/filter/filter_based_player_worker_handler.h" +#include #include #include "starboard/audio_sink.h" @@ -115,7 +116,7 @@ HandlerResult FilterBasedPlayerWorkerHandler::Init( update_player_state_cb_ = update_player_state_cb; update_player_error_cb_ = update_player_error_cb; - unique_ptr_alias factory = + std::unique_ptr factory = PlayerComponents::Factory::Create(); SB_DCHECK(factory); @@ -517,7 +518,7 @@ void FilterBasedPlayerWorkerHandler::Stop() { RemoveJobByToken(update_job_token_); - unique_ptr_alias player_components; + std::unique_ptr player_components; { // Set |player_components_| to null with the lock, but we actually destroy // it outside of the lock. This is because the VideoRenderer destructor diff --git a/starboard/shared/starboard/player/filter/filter_based_player_worker_handler.h b/starboard/shared/starboard/player/filter/filter_based_player_worker_handler.h index 2021d7deee54a..fdefa4e46b85c 100644 --- a/starboard/shared/starboard/player/filter/filter_based_player_worker_handler.h +++ b/starboard/shared/starboard/player/filter/filter_based_player_worker_handler.h @@ -19,7 +19,6 @@ #include #include -#include "starboard/common/scoped_ptr.h" #include "starboard/configuration.h" #include "starboard/decode_target.h" #include "starboard/media.h" @@ -92,7 +91,7 @@ class FilterBasedPlayerWorkerHandler : public PlayerWorker::Handler, // other accesses are happening from the same thread. Mutex player_components_existence_mutex_; - unique_ptr_alias player_components_; + std::unique_ptr player_components_; // The following three variables cache the return values of member functions // of |player_components_|. Their lifetime is tied to |player_components_|. MediaTimeProvider* media_time_provider_ = nullptr; diff --git a/starboard/shared/starboard/player/filter/interleaved_sinc_resampler.h b/starboard/shared/starboard/player/filter/interleaved_sinc_resampler.h index 9382edf1a0e76..1b904a190e07a 100644 --- a/starboard/shared/starboard/player/filter/interleaved_sinc_resampler.h +++ b/starboard/shared/starboard/player/filter/interleaved_sinc_resampler.h @@ -27,7 +27,6 @@ #include #include "starboard/common/ref_counted.h" -#include "starboard/common/scoped_ptr.h" #include "starboard/shared/internal_only.h" namespace starboard { diff --git a/starboard/shared/starboard/player/filter/media_time_provider_impl.h b/starboard/shared/starboard/player/filter/media_time_provider_impl.h index c800c7edf5c64..6d5a2a3d30df7 100644 --- a/starboard/shared/starboard/player/filter/media_time_provider_impl.h +++ b/starboard/shared/starboard/player/filter/media_time_provider_impl.h @@ -18,7 +18,6 @@ #include #include "starboard/common/mutex.h" -#include "starboard/common/scoped_ptr.h" #include "starboard/common/time.h" #include "starboard/media.h" #include "starboard/shared/internal_only.h" diff --git a/starboard/shared/starboard/player/filter/player_components.cc b/starboard/shared/starboard/player/filter/player_components.cc index 6c6eed22dd771..7602a546b5f7d 100644 --- a/starboard/shared/starboard/player/filter/player_components.cc +++ b/starboard/shared/starboard/player/filter/player_components.cc @@ -14,6 +14,7 @@ #include "starboard/shared/starboard/player/filter/player_components.h" +#include #include #include "starboard/common/time.h" @@ -53,8 +54,8 @@ class PlayerComponentsImpl : public PlayerComponents { public: PlayerComponentsImpl( std::unique_ptr media_time_provider, - unique_ptr_alias audio_renderer, - unique_ptr_alias video_renderer) + std::unique_ptr audio_renderer, + std::unique_ptr video_renderer) : media_time_provider_(std::move(media_time_provider)), audio_renderer_(std::move(audio_renderer)), video_renderer_(std::move(video_renderer)) { @@ -73,8 +74,8 @@ class PlayerComponentsImpl : public PlayerComponents { private: // |media_time_provider_| will only be used when |audio_renderer_| is nullptr. std::unique_ptr media_time_provider_; - unique_ptr_alias audio_renderer_; - unique_ptr_alias video_renderer_; + std::unique_ptr audio_renderer_; + std::unique_ptr video_renderer_; }; int AlignUp(int value, int alignment) { @@ -143,17 +144,17 @@ PlayerComponents::Factory::CreationParameters::CreationParameters( this->drm_system_ = that.drm_system_; } -unique_ptr_alias PlayerComponents::Factory::CreateComponents( +std::unique_ptr PlayerComponents::Factory::CreateComponents( const CreationParameters& creation_parameters, std::string* error_message) { SB_DCHECK(creation_parameters.audio_codec() != kSbMediaAudioCodecNone || creation_parameters.video_codec() != kSbMediaVideoCodecNone); SB_DCHECK(error_message); - unique_ptr_alias audio_decoder; - unique_ptr_alias audio_renderer_sink; - unique_ptr_alias video_decoder; - unique_ptr_alias video_render_algorithm; + std::unique_ptr audio_decoder; + std::unique_ptr audio_renderer_sink; + std::unique_ptr video_decoder; + std::unique_ptr video_render_algorithm; scoped_refptr video_renderer_sink; auto command_line = shared::starboard::Application::Get()->GetCommandLine(); @@ -178,7 +179,7 @@ unique_ptr_alias PlayerComponents::Factory::CreateComponents( &audio_renderer_sink, &video_decoder, &video_render_algorithm, &video_renderer_sink, error_message)) { - return unique_ptr_alias(); + return std::unique_ptr(); } if (use_stub_audio_decoder) { SB_DCHECK(!audio_decoder); @@ -195,8 +196,8 @@ unique_ptr_alias PlayerComponents::Factory::CreateComponents( } std::unique_ptr media_time_provider_impl; - unique_ptr_alias audio_renderer; - unique_ptr_alias video_renderer; + std::unique_ptr audio_renderer; + std::unique_ptr video_renderer; if (creation_parameters.audio_codec() != kSbMediaAudioCodecNone) { SB_DCHECK(audio_decoder); @@ -231,21 +232,21 @@ unique_ptr_alias PlayerComponents::Factory::CreateComponents( } SB_DCHECK(audio_renderer || video_renderer); - return unique_ptr_alias(new PlayerComponentsImpl( + return std::unique_ptr(new PlayerComponentsImpl( std::move(media_time_provider_impl), std::move(audio_renderer), std::move(video_renderer))); } void PlayerComponents::Factory::CreateStubAudioComponents( const CreationParameters& creation_parameters, - unique_ptr_alias* audio_decoder, - unique_ptr_alias* audio_renderer_sink) { + std::unique_ptr* audio_decoder, + std::unique_ptr* audio_renderer_sink) { SB_DCHECK(audio_decoder); SB_DCHECK(audio_renderer_sink); auto decoder_creator = [](const media::AudioStreamInfo& audio_stream_info, SbDrmSystem drm_system) { - return unique_ptr_alias( + return std::unique_ptr( new StubAudioDecoder(audio_stream_info)); }; audio_decoder->reset(new AdaptiveAudioDecoder( @@ -256,8 +257,8 @@ void PlayerComponents::Factory::CreateStubAudioComponents( void PlayerComponents::Factory::CreateStubVideoComponents( const CreationParameters& creation_parameters, - unique_ptr_alias* video_decoder, - unique_ptr_alias* video_render_algorithm, + std::unique_ptr* video_decoder, + std::unique_ptr* video_render_algorithm, scoped_refptr* video_renderer_sink) { const int64_t kVideoSinkRenderIntervalUsec = 10'000; // 10ms diff --git a/starboard/shared/starboard/player/filter/player_components.h b/starboard/shared/starboard/player/filter/player_components.h index 1c3e9133f8720..33538626d7b29 100644 --- a/starboard/shared/starboard/player/filter/player_components.h +++ b/starboard/shared/starboard/player/filter/player_components.h @@ -21,7 +21,6 @@ #include "starboard/common/log.h" #include "starboard/common/ref_counted.h" -#include "starboard/common/scoped_ptr.h" #include "starboard/decode_target.h" #include "starboard/drm.h" #include "starboard/media.h" @@ -155,7 +154,7 @@ class PlayerComponents { // TODO: Consider making it return Factory*. // Individual platform should implement this function to allow the creation // of a Factory instance. - static unique_ptr_alias Create(); + static std::unique_ptr Create(); // Individual implementations must implement this function to indicate which // output modes they support. @@ -163,7 +162,7 @@ class PlayerComponents { SbMediaVideoCodec codec, SbDrmSystem drm_system); - virtual unique_ptr_alias CreateComponents( + virtual std::unique_ptr CreateComponents( const CreationParameters& creation_parameters, std::string* error_message); @@ -175,10 +174,10 @@ class PlayerComponents { // unit tests to run. virtual bool CreateSubComponents( const CreationParameters& creation_parameters, - unique_ptr_alias* audio_decoder, - unique_ptr_alias* audio_renderer_sink, - unique_ptr_alias* video_decoder, - unique_ptr_alias* video_render_algorithm, + std::unique_ptr* audio_decoder, + std::unique_ptr* audio_renderer_sink, + std::unique_ptr* video_decoder, + std::unique_ptr* video_render_algorithm, scoped_refptr* video_renderer_sink, std::string* error_message) = 0; @@ -187,13 +186,13 @@ class PlayerComponents { void CreateStubAudioComponents( const CreationParameters& creation_parameters, - unique_ptr_alias* audio_decoder, - unique_ptr_alias* audio_renderer_sink); + std::unique_ptr* audio_decoder, + std::unique_ptr* audio_renderer_sink); void CreateStubVideoComponents( const CreationParameters& creation_parameters, - unique_ptr_alias* video_decoder, - unique_ptr_alias* video_render_algorithm, + std::unique_ptr* video_decoder, + std::unique_ptr* video_render_algorithm, scoped_refptr* video_renderer_sink); // Check AudioRenderer ctor for more details on the parameters. diff --git a/starboard/shared/starboard/player/filter/stub_player_components_factory.cc b/starboard/shared/starboard/player/filter/stub_player_components_factory.cc index 908ba94b35788..330f79bfd3f65 100644 --- a/starboard/shared/starboard/player/filter/stub_player_components_factory.cc +++ b/starboard/shared/starboard/player/filter/stub_player_components_factory.cc @@ -23,9 +23,9 @@ namespace player { namespace filter { // static -unique_ptr_alias +std::unique_ptr StubPlayerComponentsFactory::Create() { - return unique_ptr_alias( + return std::unique_ptr( new StubPlayerComponentsFactory); } diff --git a/starboard/shared/starboard/player/filter/stub_player_components_factory.h b/starboard/shared/starboard/player/filter/stub_player_components_factory.h index f662ae8df6d3b..dafa0705109ed 100644 --- a/starboard/shared/starboard/player/filter/stub_player_components_factory.h +++ b/starboard/shared/starboard/player/filter/stub_player_components_factory.h @@ -15,6 +15,7 @@ #ifndef STARBOARD_SHARED_STARBOARD_PLAYER_FILTER_STUB_PLAYER_COMPONENTS_FACTORY_H_ #define STARBOARD_SHARED_STARBOARD_PLAYER_FILTER_STUB_PLAYER_COMPONENTS_FACTORY_H_ +#include #include #include "starboard/common/log.h" @@ -28,14 +29,14 @@ namespace filter { class StubPlayerComponentsFactory : public PlayerComponents::Factory { public: - static unique_ptr_alias Create(); + static std::unique_ptr Create(); bool CreateSubComponents( const CreationParameters& creation_parameters, - unique_ptr_alias* audio_decoder, - unique_ptr_alias* audio_renderer_sink, - unique_ptr_alias* video_decoder, - unique_ptr_alias* video_render_algorithm, + std::unique_ptr* audio_decoder, + std::unique_ptr* audio_renderer_sink, + std::unique_ptr* video_decoder, + std::unique_ptr* video_render_algorithm, scoped_refptr* video_renderer_sink, std::string* error_message) override { SB_DCHECK(error_message); diff --git a/starboard/shared/starboard/player/filter/testing/adaptive_audio_decoder_test.cc b/starboard/shared/starboard/player/filter/testing/adaptive_audio_decoder_test.cc index 6059bf4163ee0..7d0eb42e3d2cb 100644 --- a/starboard/shared/starboard/player/filter/testing/adaptive_audio_decoder_test.cc +++ b/starboard/shared/starboard/player/filter/testing/adaptive_audio_decoder_test.cc @@ -24,7 +24,6 @@ #include #include "starboard/common/mutex.h" -#include "starboard/common/scoped_ptr.h" #include "starboard/common/time.h" #include "starboard/configuration_constants.h" #include "starboard/shared/starboard/media/media_support_internal.h" @@ -99,7 +98,7 @@ class AdaptiveAudioDecoderTest ASSERT_GT(dmp_reader->number_of_audio_buffers(), 0); } - unique_ptr_alias audio_renderer_sink; + std::unique_ptr audio_renderer_sink; ASSERT_TRUE(CreateAudioComponents(using_stub_decoder_, dmp_readers_[0]->audio_stream_info(), &audio_decoder_, &audio_renderer_sink)); @@ -280,7 +279,7 @@ class AdaptiveAudioDecoderTest bool using_stub_decoder_; JobQueue job_queue_; - unique_ptr_alias audio_decoder_; + std::unique_ptr audio_decoder_; Mutex event_queue_mutex_; std::deque event_queue_; diff --git a/starboard/shared/starboard/player/filter/testing/audio_channel_layout_mixer_test.cc b/starboard/shared/starboard/player/filter/testing/audio_channel_layout_mixer_test.cc index e85b02be6ebb7..2c9b4e512f112 100644 --- a/starboard/shared/starboard/player/filter/testing/audio_channel_layout_mixer_test.cc +++ b/starboard/shared/starboard/player/filter/testing/audio_channel_layout_mixer_test.cc @@ -20,7 +20,6 @@ #include #include "starboard/common/ref_counted.h" -#include "starboard/common/scoped_ptr.h" #include "starboard/shared/starboard/player/decoded_audio_internal.h" #include "testing/gtest/include/gtest/gtest.h" diff --git a/starboard/shared/starboard/player/filter/testing/audio_decoder_benchmark.cc b/starboard/shared/starboard/player/filter/testing/audio_decoder_benchmark.cc index 3a9794ba3608b..30af2bb9daaac 100644 --- a/starboard/shared/starboard/player/filter/testing/audio_decoder_benchmark.cc +++ b/starboard/shared/starboard/player/filter/testing/audio_decoder_benchmark.cc @@ -15,6 +15,7 @@ #include "starboard/shared/starboard/player/filter/audio_decoder_internal.h" #include +#include #include "starboard/common/log.h" #include "starboard/media.h" @@ -110,8 +111,8 @@ class AudioDecoderHelper { size_t current_input_buffer_index_ = 0; bool end_of_stream_decoded_ = false; - unique_ptr_alias audio_decoder_; - unique_ptr_alias audio_renderer_sink_; + std::unique_ptr audio_decoder_; + std::unique_ptr audio_renderer_sink_; }; } // namespace diff --git a/starboard/shared/starboard/player/filter/testing/audio_decoder_test.cc b/starboard/shared/starboard/player/filter/testing/audio_decoder_test.cc index 207c2a960f790..77daf30c795e2 100644 --- a/starboard/shared/starboard/player/filter/testing/audio_decoder_test.cc +++ b/starboard/shared/starboard/player/filter/testing/audio_decoder_test.cc @@ -20,6 +20,7 @@ #include #include #include +#include #include #include #include @@ -28,7 +29,6 @@ #include "starboard/common/media.h" #include "starboard/common/mutex.h" #include "starboard/common/ref_counted.h" -#include "starboard/common/scoped_ptr.h" #include "starboard/common/time.h" #include "starboard/configuration_constants.h" #include "starboard/media.h" @@ -126,8 +126,8 @@ class AudioDecoderTest void CreateComponents( const media::AudioStreamInfo& audio_stream_info, - unique_ptr_alias* audio_decoder, - unique_ptr_alias* audio_renderer_sink) { + std::unique_ptr* audio_decoder, + std::unique_ptr* audio_renderer_sink) { if (CreateAudioComponents(using_stub_decoder_, audio_stream_info, audio_decoder, audio_renderer_sink)) { SB_CHECK(*audio_decoder); @@ -485,8 +485,8 @@ class AudioDecoderTest JobQueue job_queue_; VideoDmpReader dmp_reader_; - unique_ptr_alias audio_decoder_; - unique_ptr_alias audio_renderer_sink_; + std::unique_ptr audio_decoder_; + std::unique_ptr audio_renderer_sink_; bool can_accept_more_input_ = true; scoped_refptr last_input_buffer_; @@ -518,8 +518,8 @@ TEST_P(AudioDecoderTest, MultiDecoders) { const int kDecodersToCreate = 100; const int kMinimumNumberOfExtraDecodersRequired = 3; - unique_ptr_alias audio_decoders[kDecodersToCreate]; - unique_ptr_alias audio_renderer_sinks[kDecodersToCreate]; + std::unique_ptr audio_decoders[kDecodersToCreate]; + std::unique_ptr audio_renderer_sinks[kDecodersToCreate]; for (int i = 0; i < kDecodersToCreate; ++i) { CreateComponents(dmp_reader_.audio_stream_info(), &audio_decoders[i], diff --git a/starboard/shared/starboard/player/filter/testing/audio_renderer_internal_test.cc b/starboard/shared/starboard/player/filter/testing/audio_renderer_internal_test.cc index bbb23b74fda94..e8b0ed68076d7 100644 --- a/starboard/shared/starboard/player/filter/testing/audio_renderer_internal_test.cc +++ b/starboard/shared/starboard/player/filter/testing/audio_renderer_internal_test.cc @@ -15,10 +15,10 @@ #include "starboard/shared/starboard/player/filter/audio_renderer_internal_pcm.h" #include +#include #include #include "starboard/common/log.h" -#include "starboard/common/scoped_ptr.h" #include "starboard/common/time.h" #include "starboard/media.h" #include "starboard/memory.h" @@ -116,8 +116,8 @@ class AudioRendererTest : public ::testing::Test { const int kMaxCachedFrames = 256 * 1024; const int kMaxFramesPerAppend = 16384; audio_renderer_.reset(new AudioRendererPcm( - unique_ptr_alias(audio_decoder_), - unique_ptr_alias(audio_renderer_sink_), + std::unique_ptr(audio_decoder_), + std::unique_ptr(audio_renderer_sink_), GetDefaultAudioStreamInfo(), kMaxCachedFrames, kMaxFramesPerAppend)); audio_renderer_->Initialize( std::bind(&AudioRendererTest::OnError, this), diff --git a/starboard/shared/starboard/player/filter/testing/player_components_test.cc b/starboard/shared/starboard/player/filter/testing/player_components_test.cc index 99139f999bdee..d5c34f20dc0ef 100644 --- a/starboard/shared/starboard/player/filter/testing/player_components_test.cc +++ b/starboard/shared/starboard/player/filter/testing/player_components_test.cc @@ -21,7 +21,6 @@ #include #include -#include "starboard/common/scoped_ptr.h" #include "starboard/common/string.h" #include "starboard/common/time.h" #include "starboard/media.h" @@ -87,7 +86,7 @@ class PlayerComponentsTest video_filename_.c_str(), VideoDmpReader::kEnableReadOnDemand)); } - unique_ptr_alias factory = + unique_ptr factory = PlayerComponents::Factory::Create(); string error_message; if (audio_reader_ && video_reader_) { @@ -486,7 +485,7 @@ class PlayerComponentsTest FakeGraphicsContextProvider fake_graphics_context_provider_; unique_ptr audio_reader_; unique_ptr video_reader_; - unique_ptr_alias player_components_; + unique_ptr player_components_; double playback_rate_ = 1.0; int audio_index_ = 0; int video_index_ = 0; diff --git a/starboard/shared/starboard/player/filter/testing/test_util.cc b/starboard/shared/starboard/player/filter/testing/test_util.cc index c833df3736dd5..fa358e3df207b 100644 --- a/starboard/shared/starboard/player/filter/testing/test_util.cc +++ b/starboard/shared/starboard/player/filter/testing/test_util.cc @@ -220,8 +220,8 @@ std::vector GetSupportedVideoTests() { bool CreateAudioComponents( bool using_stub_decoder, const media::AudioStreamInfo& audio_stream_info, - unique_ptr_alias* audio_decoder, - unique_ptr_alias* audio_renderer_sink) { + std::unique_ptr* audio_decoder, + std::unique_ptr* audio_renderer_sink) { SB_CHECK(audio_decoder); SB_CHECK(audio_renderer_sink); @@ -231,7 +231,7 @@ bool CreateAudioComponents( PlayerComponents::Factory::CreationParameters creation_parameters( audio_stream_info); - unique_ptr_alias factory; + std::unique_ptr factory; if (using_stub_decoder) { factory = StubPlayerComponentsFactory::Create(); } else { diff --git a/starboard/shared/starboard/player/filter/testing/test_util.h b/starboard/shared/starboard/player/filter/testing/test_util.h index 7e4ad9732854c..85e763382a523 100644 --- a/starboard/shared/starboard/player/filter/testing/test_util.h +++ b/starboard/shared/starboard/player/filter/testing/test_util.h @@ -15,6 +15,7 @@ #ifndef STARBOARD_SHARED_STARBOARD_PLAYER_FILTER_TESTING_TEST_UTIL_H_ #define STARBOARD_SHARED_STARBOARD_PLAYER_FILTER_TESTING_TEST_UTIL_H_ +#include #include #include #include @@ -59,8 +60,8 @@ std::vector GetSupportedVideoTests(); bool CreateAudioComponents( bool using_stub_decoder, const media::AudioStreamInfo& audio_stream_info, - unique_ptr_alias* audio_decoder, - unique_ptr_alias* audio_renderer_sink); + std::unique_ptr* audio_decoder, + std::unique_ptr* audio_renderer_sink); ::testing::AssertionResult AlmostEqualTime(int64_t time1, int64_t time2); diff --git a/starboard/shared/starboard/player/filter/testing/video_decoder_test.cc b/starboard/shared/starboard/player/filter/testing/video_decoder_test.cc index 9d0f598e450cc..92f75335095dd 100644 --- a/starboard/shared/starboard/player/filter/testing/video_decoder_test.cc +++ b/starboard/shared/starboard/player/filter/testing/video_decoder_test.cc @@ -18,11 +18,11 @@ #include #include #include +#include #include #include "starboard/common/condition_variable.h" #include "starboard/common/mutex.h" -#include "starboard/common/scoped_ptr.h" #include "starboard/common/string.h" #include "starboard/common/time.h" #include "starboard/configuration_constants.h" @@ -132,7 +132,7 @@ TEST_P(VideoDecoderTest, ThreeMoreDecoders) { // Create three more decoders for each supported combinations. const int kDecodersToCreate = 3; - unique_ptr_alias factory = + std::unique_ptr factory = PlayerComponents::Factory::Create(); SbPlayerOutputMode kOutputModes[] = {kSbPlayerOutputModeDecodeToTexture, @@ -149,8 +149,8 @@ TEST_P(VideoDecoderTest, ThreeMoreDecoders) { if (PlayerComponents::Factory::OutputModeSupported( output_mode, video_codec, kSbDrmSystemInvalid)) { SbPlayerPrivate players[kDecodersToCreate]; - unique_ptr_alias video_decoders[kDecodersToCreate]; - unique_ptr_alias + std::unique_ptr video_decoders[kDecodersToCreate]; + std::unique_ptr video_render_algorithms[kDecodersToCreate]; scoped_refptr video_renderer_sinks[kDecodersToCreate]; diff --git a/starboard/shared/starboard/player/filter/testing/video_decoder_test_fixture.cc b/starboard/shared/starboard/player/filter/testing/video_decoder_test_fixture.cc index 627e5d3e85d1e..a5fa5183513c3 100644 --- a/starboard/shared/starboard/player/filter/testing/video_decoder_test_fixture.cc +++ b/starboard/shared/starboard/player/filter/testing/video_decoder_test_fixture.cc @@ -20,6 +20,7 @@ #include #include #include +#include #include #include #include @@ -27,7 +28,6 @@ #include "starboard/common/condition_variable.h" #include "starboard/common/mutex.h" -#include "starboard/common/scoped_ptr.h" #include "starboard/common/string.h" #include "starboard/common/time.h" #include "starboard/configuration_constants.h" @@ -94,7 +94,7 @@ void VideoDecoderTestFixture::Initialize() { fake_graphics_context_provider_->decoder_target_provider(), nullptr); ASSERT_EQ(creation_parameters.max_video_input_size(), max_video_input_size); - unique_ptr_alias factory; + std::unique_ptr factory; if (using_stub_decoder_) { factory = StubPlayerComponentsFactory::Create(); } else { diff --git a/starboard/shared/starboard/player/filter/testing/video_decoder_test_fixture.h b/starboard/shared/starboard/player/filter/testing/video_decoder_test_fixture.h index 5bf2ca4dc47ed..09f4de5103b9c 100644 --- a/starboard/shared/starboard/player/filter/testing/video_decoder_test_fixture.h +++ b/starboard/shared/starboard/player/filter/testing/video_decoder_test_fixture.h @@ -19,11 +19,11 @@ #include #include #include +#include #include #include "starboard/common/condition_variable.h" #include "starboard/common/mutex.h" -#include "starboard/common/scoped_ptr.h" #include "starboard/common/string.h" #include "starboard/configuration_constants.h" #include "starboard/drm.h" @@ -129,7 +129,7 @@ class VideoDecoderTestFixture { void UseInvalidDataForInput(size_t index, uint8_t byte_to_fill) { invalid_inputs_[index] = byte_to_fill; } - const unique_ptr_alias& video_decoder() const { + const std::unique_ptr& video_decoder() const { return video_decoder_; } const video_dmp::VideoDmpReader& dmp_reader() const { return dmp_reader_; } @@ -157,14 +157,14 @@ class VideoDecoderTestFixture { ::starboard::testing::FakeGraphicsContextProvider* fake_graphics_context_provider_; video_dmp::VideoDmpReader dmp_reader_; - unique_ptr_alias video_decoder_; + std::unique_ptr video_decoder_; bool need_more_input_ = true; std::set outstanding_inputs_; std::deque> decoded_frames_; SbPlayerPrivate player_; - unique_ptr_alias video_render_algorithm_; + std::unique_ptr video_render_algorithm_; scoped_refptr video_renderer_sink_; bool end_of_stream_written_ = false; diff --git a/starboard/shared/starboard/player/filter/tools/audio_dmp_player.cc b/starboard/shared/starboard/player/filter/tools/audio_dmp_player.cc index 64c6e603ae5ef..9aae6fb34ad13 100644 --- a/starboard/shared/starboard/player/filter/tools/audio_dmp_player.cc +++ b/starboard/shared/starboard/player/filter/tools/audio_dmp_player.cc @@ -16,7 +16,6 @@ #include #include "starboard/common/log.h" -#include "starboard/common/scoped_ptr.h" #include "starboard/configuration_constants.h" #include "starboard/event.h" #include "starboard/player.h" @@ -43,7 +42,7 @@ const int kJobThreadStackSize = 0; #endif // SB_MEDIA_PLAYER_THREAD_STACK_SIZE std::unique_ptr s_video_dmp_reader; -starboard::unique_ptr_alias s_player_components; +std::unique_ptr s_player_components; int s_audio_sample_index; std::unique_ptr s_job_thread; int64_t s_duration; @@ -101,7 +100,7 @@ void EndedCB() { void Start(const char* filename) { SB_LOG(INFO) << "Loading " << filename; s_video_dmp_reader.reset(new VideoDmpReader(filename)); - starboard::unique_ptr_alias factory = + std::unique_ptr factory = PlayerComponents::Factory::Create(); PlayerComponents::Factory::CreationParameters creation_parameters( s_video_dmp_reader->audio_stream_info()); diff --git a/starboard/shared/starboard/player/filter/video_renderer_internal.h b/starboard/shared/starboard/player/filter/video_renderer_internal.h index 560c84d37f32e..4f4fd8690f89f 100644 --- a/starboard/shared/starboard/player/filter/video_renderer_internal.h +++ b/starboard/shared/starboard/player/filter/video_renderer_internal.h @@ -16,7 +16,6 @@ #define STARBOARD_SHARED_STARBOARD_PLAYER_FILTER_VIDEO_RENDERER_INTERNAL_H_ #include "starboard/common/ref_counted.h" -#include "starboard/common/scoped_ptr.h" #include "starboard/shared/internal_only.h" #include "starboard/shared/starboard/player/filter/common.h" #include "starboard/shared/starboard/player/input_buffer_internal.h" diff --git a/starboard/shared/starboard/player/filter/video_renderer_internal_impl.cc b/starboard/shared/starboard/player/filter/video_renderer_internal_impl.cc index bae367bbc297b..2b7c6410ac6b6 100644 --- a/starboard/shared/starboard/player/filter/video_renderer_internal_impl.cc +++ b/starboard/shared/starboard/player/filter/video_renderer_internal_impl.cc @@ -16,6 +16,7 @@ #include #include +#include #include #include "starboard/common/time.h" @@ -36,9 +37,9 @@ const int64_t kSeekTimeoutRetryInterval = 25'000; // 25ms } // namespace VideoRendererImpl::VideoRendererImpl( - unique_ptr_alias decoder, + std::unique_ptr decoder, MediaTimeProvider* media_time_provider, - unique_ptr_alias algorithm, + std::unique_ptr algorithm, scoped_refptr sink) : media_time_provider_(media_time_provider), algorithm_(std::move(algorithm)), diff --git a/starboard/shared/starboard/player/filter/video_renderer_internal_impl.h b/starboard/shared/starboard/player/filter/video_renderer_internal_impl.h index bc7ff00bb8374..36b310e64abea 100644 --- a/starboard/shared/starboard/player/filter/video_renderer_internal_impl.h +++ b/starboard/shared/starboard/player/filter/video_renderer_internal_impl.h @@ -22,7 +22,6 @@ #include "starboard/common/log.h" #include "starboard/common/mutex.h" #include "starboard/common/ref_counted.h" -#include "starboard/common/scoped_ptr.h" #include "starboard/media.h" #include "starboard/shared/internal_only.h" #include "starboard/shared/starboard/player/filter/common.h" @@ -47,9 +46,9 @@ class VideoRendererImpl : public VideoRenderer, private JobQueue::JobOwner { public: // All of the functions are called on the PlayerWorker thread unless marked // otherwise. - VideoRendererImpl(unique_ptr_alias decoder, + VideoRendererImpl(std::unique_ptr decoder, MediaTimeProvider* media_time_provider, - unique_ptr_alias algorithm, + std::unique_ptr algorithm, scoped_refptr sink); ~VideoRendererImpl() override; @@ -85,9 +84,9 @@ class VideoRendererImpl : public VideoRenderer, private JobQueue::JobOwner { void OnSeekTimeout(); MediaTimeProvider* const media_time_provider_; - unique_ptr_alias algorithm_; + std::unique_ptr algorithm_; scoped_refptr sink_; - unique_ptr_alias decoder_; + std::unique_ptr decoder_; PrerolledCB prerolled_cb_; EndedCB ended_cb_; diff --git a/starboard/shared/starboard/player/job_thread.h b/starboard/shared/starboard/player/job_thread.h index 227f0a573a109..0eb02fa7acd7a 100644 --- a/starboard/shared/starboard/player/job_thread.h +++ b/starboard/shared/starboard/player/job_thread.h @@ -21,7 +21,6 @@ #include #include "starboard/common/log.h" -#include "starboard/common/scoped_ptr.h" #include "starboard/shared/internal_only.h" #include "starboard/shared/starboard/player/job_queue.h" diff --git a/starboard/shared/starboard/player/player_create.cc b/starboard/shared/starboard/player/player_create.cc index d3f721aa14635..291854b22581a 100644 --- a/starboard/shared/starboard/player/player_create.cc +++ b/starboard/shared/starboard/player/player_create.cc @@ -12,6 +12,7 @@ // See the License for the specific language governing permissions and // limitations under the License. +#include #include #include @@ -211,7 +212,7 @@ SbPlayer SbPlayerCreate(SbWindow window, UpdateActiveSessionPlatformPlaybackState(kPlaying); - starboard::unique_ptr_alias handler( + std::unique_ptr handler( new FilterBasedPlayerWorkerHandler(creation_param, provider)); SbPlayer player = SbPlayerPrivate::CreateInstance( diff --git a/starboard/shared/starboard/player/player_internal.cc b/starboard/shared/starboard/player/player_internal.cc index 8dcd52133c97d..225d4a8d96ae4 100644 --- a/starboard/shared/starboard/player/player_internal.cc +++ b/starboard/shared/starboard/player/player_internal.cc @@ -15,6 +15,7 @@ #include "starboard/shared/starboard/player/player_internal.h" #include +#include #include #include "starboard/common/log.h" @@ -51,7 +52,7 @@ SbPlayerPrivate::SbPlayerPrivate( SbPlayerStatusFunc player_status_func, SbPlayerErrorFunc player_error_func, void* context, - starboard::unique_ptr_alias player_worker_handler) + std::unique_ptr player_worker_handler) : sample_deallocate_func_(sample_deallocate_func), context_(context), media_time_updated_at_(starboard::CurrentMonotonicTime()) { @@ -75,7 +76,7 @@ SbPlayerPrivate* SbPlayerPrivate::CreateInstance( SbPlayerStatusFunc player_status_func, SbPlayerErrorFunc player_error_func, void* context, - starboard::unique_ptr_alias player_worker_handler) { + std::unique_ptr player_worker_handler) { SbPlayerPrivate* ret = new SbPlayerPrivate( audio_codec, video_codec, sample_deallocate_func, decoder_status_func, player_status_func, player_error_func, context, diff --git a/starboard/shared/starboard/player/player_internal.h b/starboard/shared/starboard/player/player_internal.h index e58c668d6388f..05d64a11886ab 100644 --- a/starboard/shared/starboard/player/player_internal.h +++ b/starboard/shared/starboard/player/player_internal.h @@ -19,7 +19,6 @@ #include #include -#include "starboard/common/scoped_ptr.h" #include "starboard/decode_target.h" #include "starboard/extension/enhanced_audio.h" #include "starboard/media.h" @@ -46,7 +45,7 @@ struct SbPlayerPrivate { SbPlayerStatusFunc player_status_func, SbPlayerErrorFunc player_error_func, void* context, - starboard::unique_ptr_alias player_worker_handler); + std::unique_ptr player_worker_handler); void Seek(int64_t seek_to_time, int ticket); template @@ -76,15 +75,14 @@ struct SbPlayerPrivate { } private: - SbPlayerPrivate( - SbMediaAudioCodec audio_codec, - SbMediaVideoCodec video_codec, - SbPlayerDeallocateSampleFunc sample_deallocate_func, - SbPlayerDecoderStatusFunc decoder_status_func, - SbPlayerStatusFunc player_status_func, - SbPlayerErrorFunc player_error_func, - void* context, - starboard::unique_ptr_alias player_worker_handler); + SbPlayerPrivate(SbMediaAudioCodec audio_codec, + SbMediaVideoCodec video_codec, + SbPlayerDeallocateSampleFunc sample_deallocate_func, + SbPlayerDecoderStatusFunc decoder_status_func, + SbPlayerStatusFunc player_status_func, + SbPlayerErrorFunc player_error_func, + void* context, + std::unique_ptr player_worker_handler); SbPlayerPrivate(const SbPlayerPrivate&) = delete; SbPlayerPrivate& operator=(const SbPlayerPrivate&) = delete; diff --git a/starboard/shared/starboard/player/player_worker.cc b/starboard/shared/starboard/player/player_worker.cc index c0bbc6d374320..7b812ed34b1e6 100644 --- a/starboard/shared/starboard/player/player_worker.cc +++ b/starboard/shared/starboard/player/player_worker.cc @@ -16,6 +16,7 @@ #include +#include #include #include @@ -68,7 +69,7 @@ struct ThreadParam { PlayerWorker* PlayerWorker::CreateInstance( SbMediaAudioCodec audio_codec, SbMediaVideoCodec video_codec, - unique_ptr_alias handler, + std::unique_ptr handler, UpdateMediaInfoCB update_media_info_cb, SbPlayerDecoderStatusFunc decoder_status_func, SbPlayerStatusFunc player_status_func, @@ -103,7 +104,7 @@ PlayerWorker::~PlayerWorker() { PlayerWorker::PlayerWorker(SbMediaAudioCodec audio_codec, SbMediaVideoCodec video_codec, - unique_ptr_alias handler, + std::unique_ptr handler, UpdateMediaInfoCB update_media_info_cb, SbPlayerDecoderStatusFunc decoder_status_func, SbPlayerStatusFunc player_status_func, diff --git a/starboard/shared/starboard/player/player_worker.h b/starboard/shared/starboard/player/player_worker.h index d71dda6dad2b5..5f0d0ddd0a582 100644 --- a/starboard/shared/starboard/player/player_worker.h +++ b/starboard/shared/starboard/player/player_worker.h @@ -25,7 +25,6 @@ #include "starboard/common/log.h" #include "starboard/common/ref_counted.h" -#include "starboard/common/scoped_ptr.h" #include "starboard/media.h" #include "starboard/player.h" #include "starboard/shared/internal_only.h" @@ -121,7 +120,7 @@ class PlayerWorker { static PlayerWorker* CreateInstance( SbMediaAudioCodec audio_codec, SbMediaVideoCodec video_codec, - unique_ptr_alias handler, + std::unique_ptr handler, UpdateMediaInfoCB update_media_info_cb, SbPlayerDecoderStatusFunc decoder_status_func, SbPlayerStatusFunc player_status_func, @@ -182,7 +181,7 @@ class PlayerWorker { private: PlayerWorker(SbMediaAudioCodec audio_codec, SbMediaVideoCodec video_codec, - unique_ptr_alias handler, + std::unique_ptr handler, UpdateMediaInfoCB update_media_info_cb, SbPlayerDecoderStatusFunc decoder_status_func, SbPlayerStatusFunc player_status_func, @@ -221,7 +220,7 @@ class PlayerWorker { SbMediaAudioCodec audio_codec_; SbMediaVideoCodec video_codec_; - unique_ptr_alias handler_; + std::unique_ptr handler_; UpdateMediaInfoCB update_media_info_cb_; SbPlayerDecoderStatusFunc decoder_status_func_; diff --git a/starboard/shared/uwp/analog_thumbstick_input_thread.cc b/starboard/shared/uwp/analog_thumbstick_input_thread.cc index 857c828518967..e8eb3f159ce89 100644 --- a/starboard/shared/uwp/analog_thumbstick_input_thread.cc +++ b/starboard/shared/uwp/analog_thumbstick_input_thread.cc @@ -22,6 +22,7 @@ #include #include +#include "starboard/common/log.h" #include "starboard/common/thread.h" #include "starboard/shared/uwp/analog_thumbstick_input.h" #include "starboard/thread.h" diff --git a/starboard/shared/uwp/media_is_video_supported.cc b/starboard/shared/uwp/media_is_video_supported.cc index 3654764ad6e6c..59ce59f6e9a73 100644 --- a/starboard/shared/uwp/media_is_video_supported.cc +++ b/starboard/shared/uwp/media_is_video_supported.cc @@ -14,6 +14,7 @@ #include "starboard/shared/starboard/media/media_support_internal.h" +#include "starboard/memory.h" #include "starboard/shared/starboard/media/video_capabilities.h" #include "starboard/shared/uwp/application_uwp.h" #include "starboard/shared/uwp/extended_resources_manager.h" diff --git a/starboard/shared/win32/audio_decoder_thread.h b/starboard/shared/win32/audio_decoder_thread.h index 44e4fcd009354..34567135a2e68 100644 --- a/starboard/shared/win32/audio_decoder_thread.h +++ b/starboard/shared/win32/audio_decoder_thread.h @@ -20,7 +20,6 @@ #include "starboard/common/atomic.h" #include "starboard/common/ref_counted.h" -#include "starboard/common/scoped_ptr.h" #include "starboard/common/semaphore.h" #include "starboard/common/thread.h" #include "starboard/media.h" diff --git a/starboard/shared/win32/media_transform.cc b/starboard/shared/win32/media_transform.cc index 6367f80d0a6d2..499454d2c95e2 100644 --- a/starboard/shared/win32/media_transform.cc +++ b/starboard/shared/win32/media_transform.cc @@ -15,7 +15,6 @@ #include "starboard/shared/win32/media_transform.h" #include "starboard/common/log.h" -#include "starboard/common/scoped_ptr.h" #include "starboard/shared/win32/audio_transform.h" #include "starboard/shared/win32/error_utils.h" #include "starboard/shared/win32/media_common.h" diff --git a/starboard/shared/win32/player_components_factory.cc b/starboard/shared/win32/player_components_factory.cc index 2a5fecc6aab68..6016791811699 100644 --- a/starboard/shared/win32/player_components_factory.cc +++ b/starboard/shared/win32/player_components_factory.cc @@ -16,7 +16,6 @@ #include "starboard/common/log.h" #include "starboard/common/ref_counted.h" -#include "starboard/common/scoped_ptr.h" #include "starboard/shared/opus/opus_audio_decoder.h" #include "starboard/shared/starboard/media/media_util.h" #include "starboard/shared/starboard/player/filter/adaptive_audio_decoder_internal.h" @@ -40,10 +39,10 @@ namespace { class PlayerComponentsFactory : public PlayerComponents::Factory { bool CreateSubComponents( const CreationParameters& creation_parameters, - scoped_ptr* audio_decoder, - scoped_ptr* audio_renderer_sink, - scoped_ptr* video_decoder, - scoped_ptr* video_render_algorithm, + std::unique_ptr* audio_decoder, + std::unique_ptr* audio_renderer_sink, + std::unique_ptr* video_decoder, + std::unique_ptr* video_render_algorithm, scoped_refptr* video_renderer_sink, std::string* error_message) override { SB_DCHECK(error_message); @@ -59,15 +58,15 @@ class PlayerComponentsFactory : public PlayerComponents::Factory { ::starboard::shared::opus::OpusAudioDecoder; if (audio_stream_info.codec == kSbMediaAudioCodecAac) { - return scoped_ptr( + return std::unique_ptr( new AacAudioDecoderImpl(audio_stream_info, drm_system)); } else if (audio_stream_info.codec == kSbMediaAudioCodecOpus) { - return scoped_ptr( + return std::unique_ptr( new OpusAudioDecoderImpl(audio_stream_info)); } else { SB_NOTREACHED(); } - return scoped_ptr(); + return std::unique_ptr(); }; audio_decoder->reset(new AdaptiveAudioDecoder( @@ -83,7 +82,7 @@ class PlayerComponentsFactory : public PlayerComponents::Factory { SB_DCHECK(video_render_algorithm); SB_DCHECK(video_renderer_sink); - scoped_ptr video_decoder_impl(new VideoDecoderImpl( + std::unique_ptr video_decoder_impl(new VideoDecoderImpl( creation_parameters.video_codec(), creation_parameters.output_mode(), creation_parameters.decode_target_graphics_context_provider(), creation_parameters.drm_system())); @@ -99,8 +98,8 @@ class PlayerComponentsFactory : public PlayerComponents::Factory { } // namespace // static -scoped_ptr PlayerComponents::Factory::Create() { - return make_scoped_ptr( +std::unique_ptr PlayerComponents::Factory::Create() { + return std::unique_ptr( new PlayerComponentsFactory); }