1
    2
    3
    4
    5
    6
    7
    8
    9
   10
   11
   12
   13
   14
   15
   16
   17
   18
   19
   20
   21
   22
   23
   24
   25
   26
   27
   28
   29
   30
   31
   32
   33
   34
   35
   36
   37
   38
   39
   40

cc / resources / ui_resource_request.cc [blame]

// Copyright 2013 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

#include "cc/resources/ui_resource_request.h"

#include "base/memory/ptr_util.h"

namespace cc {

UIResourceRequest::UIResourceRequest(Type type, UIResourceId id)
    : type_(type), id_(id) {
  DCHECK_EQ(type, Type::kDelete);
}

UIResourceRequest::UIResourceRequest(Type type,
                                     UIResourceId id,
                                     const UIResourceBitmap& bitmap)
    : type_(type), id_(id), bitmap_(new UIResourceBitmap(bitmap)) {}

UIResourceRequest::UIResourceRequest(const UIResourceRequest& request) {
  (*this) = request;
}

UIResourceRequest& UIResourceRequest::operator=(
    const UIResourceRequest& request) {
  type_ = request.type_;
  id_ = request.id_;
  if (request.bitmap_) {
    bitmap_ = base::WrapUnique(new UIResourceBitmap(*request.bitmap_.get()));
  } else {
    bitmap_ = nullptr;
  }

  return *this;
}

UIResourceRequest::~UIResourceRequest() = default;

}  // namespace cc