Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(308)

Side by Side Diff: services/media/framework/safe_clone.h

Issue 1678433002: Motown: Remove LPCM optimizations, fix prepare, add flush, add ActiveMultistreamSink model/stage (Closed) Base URL: https://github.com/domokit/mojo.git@master
Patch Set: Sync Created 4 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
(Empty)
1 // Copyright 2016 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4
5 #ifndef SERVICES_MEDIA_FRAMEWORK_SAFE_CLONE_H_
6 #define SERVICES_MEDIA_FRAMEWORK_SAFE_CLONE_H_
7
8 #include <memory>
9 #include <vector>
10
11 namespace mojo {
12 namespace media {
13
14 template<typename T>
15 std::unique_ptr<T> SafeClone(const std::unique_ptr<T>& t_ptr) {
16 return t_ptr ? t_ptr.get()->Clone() : nullptr;
17 }
18
19 template<typename T>
20 std::unique_ptr<std::vector<std::unique_ptr<T>>> SafeClone(
21 const std::unique_ptr<std::vector<std::unique_ptr<T>>>& vec) {
22 if (vec == nullptr) {
23 return nullptr;
24 }
25
26 std::unique_ptr<std::vector<std::unique_ptr<T>>> result =
27 std::unique_ptr<std::vector<std::unique_ptr<T>>>(
28 new std::vector<std::unique_ptr<T>>(vec->size()));
29
30 for (const std::unique_ptr<T>& t_ptr : *vec.get()) {
31 result->push_back(SafeClone(t_ptr));
32 }
33
34 return result;
35 }
36
37 } // namespace media
38 } // namespace mojo
39
40 #endif // SERVICES_MEDIA_FRAMEWORK_SAFE_CLONE_H_
OLDNEW
« no previous file with comments | « services/media/framework/refs.cc ('k') | services/media/framework/stages/active_multistream_sink_stage.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698