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

Side by Side Diff: ppapi/cpp/dev/directory_entry_dev.cc

Issue 5539001: Remove all the swap() stuff in the PPAPI C++ wrappers.... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: Created 10 years 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 | Annotate | Revision Log
« no previous file with comments | « ppapi/cpp/dev/directory_entry_dev.h ('k') | ppapi/cpp/dev/directory_reader_dev.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2010 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/cpp/dev/directory_entry_dev.h" 5 #include "ppapi/cpp/dev/directory_entry_dev.h"
6 6
7 #include <string.h> 7 #include <string.h>
8 8
9 #include "ppapi/cpp/module.h" 9 #include "ppapi/cpp/module.h"
10 10
(...skipping 10 matching lines...) Expand all
21 Module::Get()->core()->AddRefResource(data_.file_ref); 21 Module::Get()->core()->AddRefResource(data_.file_ref);
22 } 22 }
23 23
24 DirectoryEntry_Dev::~DirectoryEntry_Dev() { 24 DirectoryEntry_Dev::~DirectoryEntry_Dev() {
25 if (data_.file_ref) 25 if (data_.file_ref)
26 Module::Get()->core()->ReleaseResource(data_.file_ref); 26 Module::Get()->core()->ReleaseResource(data_.file_ref);
27 } 27 }
28 28
29 DirectoryEntry_Dev& DirectoryEntry_Dev::operator=( 29 DirectoryEntry_Dev& DirectoryEntry_Dev::operator=(
30 const DirectoryEntry_Dev& other) { 30 const DirectoryEntry_Dev& other) {
31 DirectoryEntry_Dev copy(other); 31 if (data_.file_ref)
32 swap(copy); 32 Module::Get()->core()->ReleaseResource(data_.file_ref);
33 data_ = other.data_;
34 if (data_.file_ref)
35 Module::Get()->core()->AddRefResource(data_.file_ref);
33 return *this; 36 return *this;
34 } 37 }
35 38
36 void DirectoryEntry_Dev::swap(DirectoryEntry_Dev& other) {
37 std::swap(data_.file_ref, other.data_.file_ref);
38 std::swap(data_.file_type, other.data_.file_type);
39 }
40
41 } // namespace pp 39 } // namespace pp
OLDNEW
« no previous file with comments | « ppapi/cpp/dev/directory_entry_dev.h ('k') | ppapi/cpp/dev/directory_reader_dev.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698