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

Side by Side Diff: ppapi/shared_impl/compositor_layer_data.cc

Issue 1864293002: Convert //ppapi to use std::unique_ptr (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: more nullptr Created 4 years, 8 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
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "ppapi/shared_impl/compositor_layer_data.h" 5 #include "ppapi/shared_impl/compositor_layer_data.h"
6 6
7 namespace ppapi { 7 namespace ppapi {
8 8
9 namespace { 9 namespace {
10 10
11 template<typename T> 11 template <typename T>
12 void Copy(scoped_ptr<T>* a, const scoped_ptr<T>& b) { 12 void Copy(std::unique_ptr<T>* a, const std::unique_ptr<T>& b) {
13 if (b) { 13 if (b) {
14 if (!(*a)) 14 if (!(*a))
15 a->reset(new T()); 15 a->reset(new T());
16 **a = *b; 16 **a = *b;
17 } else { 17 } else {
18 a->reset(); 18 a->reset();
19 } 19 }
20 } 20 }
21 21
22 } // namespace 22 } // namespace
23 23
24 const CompositorLayerData& CompositorLayerData::operator=( 24 const CompositorLayerData& CompositorLayerData::operator=(
25 const CompositorLayerData& other) { 25 const CompositorLayerData& other) {
26 DCHECK(other.is_null() || other.is_valid()); 26 DCHECK(other.is_null() || other.is_valid());
27 27
28 common = other.common; 28 common = other.common;
29 Copy(&color, other.color); 29 Copy(&color, other.color);
30 Copy(&texture, other.texture); 30 Copy(&texture, other.texture);
31 Copy(&image, other.image); 31 Copy(&image, other.image);
32 32
33 return *this; 33 return *this;
34 } 34 }
35 35
36 } // namespace ppapi 36 } // namespace ppapi
OLDNEW
« no previous file with comments | « ppapi/shared_impl/compositor_layer_data.h ('k') | ppapi/shared_impl/media_stream_buffer_manager.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698