| OLD | NEW |
| 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 Loading... |
| 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 |
| OLD | NEW |