Separate Simple Backend creation from initialization.
[chromium-blink-merge.git] / ppapi / cpp / dev / directory_entry_dev.cc
blobbef42c3f12d4f45803d1505410dbf4298e10357f
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
3 // found in the LICENSE file.
5 #include "ppapi/cpp/dev/directory_entry_dev.h"
7 #include <string.h>
9 #include "ppapi/cpp/module.h"
11 namespace pp {
13 DirectoryEntry_Dev::DirectoryEntry_Dev() {
14 memset(&data_, 0, sizeof(data_));
17 DirectoryEntry_Dev::DirectoryEntry_Dev(
18 PassRef, const PP_DirectoryEntry_Dev& data) {
19 data_.file_ref = data.file_ref;
20 data_.file_type = data.file_type;
23 DirectoryEntry_Dev::DirectoryEntry_Dev(const DirectoryEntry_Dev& other) {
24 data_.file_ref = other.data_.file_ref;
25 data_.file_type = other.data_.file_type;
26 if (data_.file_ref)
27 Module::Get()->core()->AddRefResource(data_.file_ref);
30 DirectoryEntry_Dev::~DirectoryEntry_Dev() {
31 if (data_.file_ref)
32 Module::Get()->core()->ReleaseResource(data_.file_ref);
35 DirectoryEntry_Dev& DirectoryEntry_Dev::operator=(
36 const DirectoryEntry_Dev& other) {
37 if (data_.file_ref)
38 Module::Get()->core()->ReleaseResource(data_.file_ref);
39 data_ = other.data_;
40 if (data_.file_ref)
41 Module::Get()->core()->AddRefResource(data_.file_ref);
42 return *this;
45 } // namespace pp