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

Side by Side Diff: cc/resources/ui_resource_request.cc

Issue 2154473004: Add a sanity DCHECK when constructing a UIResourceRequest. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Added a check that we're deleting when no bitmap is passed to the constructor. Created 4 years, 5 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
« no previous file with comments | « no previous file | cc/trees/layer_tree_host_impl.cc » ('j') | cc/trees/layer_tree_host_impl.cc » ('J')
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 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 "cc/resources/ui_resource_request.h" 5 #include "cc/resources/ui_resource_request.h"
6 6
7 #include "base/memory/ptr_util.h" 7 #include "base/memory/ptr_util.h"
8 8
9 namespace cc { 9 namespace cc {
10 10
11 UIResourceRequest::UIResourceRequest(UIResourceRequestType type, 11 UIResourceRequest::UIResourceRequest(UIResourceRequestType type,
12 UIResourceId id) 12 UIResourceId id)
13 : type_(type), id_(id) {} 13 : type_(type), id_(id) {
14 DCHECK(type == UIResourceRequestType.DELETE);
vmpstr 2016/07/15 21:29:23 This should be UI_RESOURCE_DELETE, right? from htt
Donn Denman 2016/07/15 22:05:56 Gee, how did that even compile? I'm pretty sure I
15 }
14 16
15 UIResourceRequest::UIResourceRequest(UIResourceRequestType type, 17 UIResourceRequest::UIResourceRequest(UIResourceRequestType type,
16 UIResourceId id, 18 UIResourceId id,
17 const UIResourceBitmap& bitmap) 19 const UIResourceBitmap& bitmap)
18 : type_(type), id_(id), bitmap_(new UIResourceBitmap(bitmap)) {} 20 : type_(type), id_(id), bitmap_(new UIResourceBitmap(bitmap)) {}
19 21
20 UIResourceRequest::UIResourceRequest(const UIResourceRequest& request) { 22 UIResourceRequest::UIResourceRequest(const UIResourceRequest& request) {
21 (*this) = request; 23 (*this) = request;
22 } 24 }
23 25
24 UIResourceRequest& UIResourceRequest::operator=( 26 UIResourceRequest& UIResourceRequest::operator=(
25 const UIResourceRequest& request) { 27 const UIResourceRequest& request) {
26 type_ = request.type_; 28 type_ = request.type_;
27 id_ = request.id_; 29 id_ = request.id_;
28 if (request.bitmap_) { 30 if (request.bitmap_) {
29 bitmap_ = base::WrapUnique(new UIResourceBitmap(*request.bitmap_.get())); 31 bitmap_ = base::WrapUnique(new UIResourceBitmap(*request.bitmap_.get()));
30 } else { 32 } else {
31 bitmap_ = nullptr; 33 bitmap_ = nullptr;
32 } 34 }
33 35
34 return *this; 36 return *this;
35 } 37 }
36 38
37 UIResourceRequest::~UIResourceRequest() {} 39 UIResourceRequest::~UIResourceRequest() {}
38 40
39 } // namespace cc 41 } // namespace cc
OLDNEW
« no previous file with comments | « no previous file | cc/trees/layer_tree_host_impl.cc » ('j') | cc/trees/layer_tree_host_impl.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698