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

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

Issue 1387283002: cc: Remove redundant is_overlay arguments (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Undo changes on overlay_strategy_single_on_top.cc Created 5 years, 2 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 | « cc/resources/texture_mailbox.h ('k') | cc/resources/transferable_resource.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 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/texture_mailbox.h" 5 #include "cc/resources/texture_mailbox.h"
6 6
7 #include "base/logging.h" 7 #include "base/logging.h"
8 #include "cc/resources/shared_bitmap.h" 8 #include "cc/resources/shared_bitmap.h"
9 9
10 namespace cc { 10 namespace cc {
11 11
12 TextureMailbox::TextureMailbox() : shared_bitmap_(NULL) { 12 TextureMailbox::TextureMailbox() : shared_bitmap_(NULL) {
13 } 13 }
14 14
15 TextureMailbox::TextureMailbox(const gpu::MailboxHolder& mailbox_holder) 15 TextureMailbox::TextureMailbox(const gpu::MailboxHolder& mailbox_holder)
16 : mailbox_holder_(mailbox_holder), 16 : mailbox_holder_(mailbox_holder),
17 shared_bitmap_(NULL), 17 shared_bitmap_(NULL),
18 allow_overlay_(false), 18 is_overlay_candidate_(false),
19 nearest_neighbor_(false) { 19 nearest_neighbor_(false) {}
20 }
21 20
22 TextureMailbox::TextureMailbox(const gpu::Mailbox& mailbox, 21 TextureMailbox::TextureMailbox(const gpu::Mailbox& mailbox,
23 uint32 target, 22 uint32 target,
24 uint32 sync_point) 23 uint32 sync_point)
25 : mailbox_holder_(mailbox, target, sync_point), 24 : mailbox_holder_(mailbox, target, sync_point),
26 shared_bitmap_(NULL), 25 shared_bitmap_(NULL),
27 allow_overlay_(false), 26 is_overlay_candidate_(false),
28 nearest_neighbor_(false) { 27 nearest_neighbor_(false) {}
29 }
30 28
31 TextureMailbox::TextureMailbox(const gpu::Mailbox& mailbox, 29 TextureMailbox::TextureMailbox(const gpu::Mailbox& mailbox,
32 uint32 target, 30 uint32 target,
33 uint32 sync_point, 31 uint32 sync_point,
34 const gfx::Size& size_in_pixels, 32 const gfx::Size& size_in_pixels,
35 bool allow_overlay) 33 bool is_overlay_candidate)
36 : mailbox_holder_(mailbox, target, sync_point), 34 : mailbox_holder_(mailbox, target, sync_point),
37 shared_bitmap_(nullptr), 35 shared_bitmap_(nullptr),
38 size_in_pixels_(size_in_pixels), 36 size_in_pixels_(size_in_pixels),
39 allow_overlay_(allow_overlay), 37 is_overlay_candidate_(is_overlay_candidate),
40 nearest_neighbor_(false) { 38 nearest_neighbor_(false) {
41 DCHECK_IMPLIES(allow_overlay, !size_in_pixels.IsEmpty()); 39 DCHECK_IMPLIES(is_overlay_candidate, !size_in_pixels.IsEmpty());
42 } 40 }
43 41
44 TextureMailbox::TextureMailbox(SharedBitmap* shared_bitmap, 42 TextureMailbox::TextureMailbox(SharedBitmap* shared_bitmap,
45 const gfx::Size& size_in_pixels) 43 const gfx::Size& size_in_pixels)
46 : shared_bitmap_(shared_bitmap), 44 : shared_bitmap_(shared_bitmap),
47 size_in_pixels_(size_in_pixels), 45 size_in_pixels_(size_in_pixels),
48 allow_overlay_(false), 46 is_overlay_candidate_(false),
49 nearest_neighbor_(false) { 47 nearest_neighbor_(false) {
50 // If an embedder of cc gives an invalid TextureMailbox, we should crash 48 // If an embedder of cc gives an invalid TextureMailbox, we should crash
51 // here to identify the offender. 49 // here to identify the offender.
52 CHECK(SharedBitmap::VerifySizeInBytes(size_in_pixels_)); 50 CHECK(SharedBitmap::VerifySizeInBytes(size_in_pixels_));
53 } 51 }
54 52
55 TextureMailbox::~TextureMailbox() {} 53 TextureMailbox::~TextureMailbox() {}
56 54
57 bool TextureMailbox::Equals(const TextureMailbox& other) const { 55 bool TextureMailbox::Equals(const TextureMailbox& other) const {
58 if (other.IsTexture()) { 56 if (other.IsTexture()) {
59 return IsTexture() && !memcmp(mailbox_holder_.mailbox.name, 57 return IsTexture() && !memcmp(mailbox_holder_.mailbox.name,
60 other.mailbox_holder_.mailbox.name, 58 other.mailbox_holder_.mailbox.name,
61 sizeof(mailbox_holder_.mailbox.name)); 59 sizeof(mailbox_holder_.mailbox.name));
62 } else if (other.IsSharedMemory()) { 60 } else if (other.IsSharedMemory()) {
63 return IsSharedMemory() && (shared_bitmap_ == other.shared_bitmap_); 61 return IsSharedMemory() && (shared_bitmap_ == other.shared_bitmap_);
64 } 62 }
65 63
66 DCHECK(!other.IsValid()); 64 DCHECK(!other.IsValid());
67 return !IsValid(); 65 return !IsValid();
68 } 66 }
69 67
70 size_t TextureMailbox::SharedMemorySizeInBytes() const { 68 size_t TextureMailbox::SharedMemorySizeInBytes() const {
71 // UncheckedSizeInBytes is okay because we VerifySizeInBytes in the 69 // UncheckedSizeInBytes is okay because we VerifySizeInBytes in the
72 // constructor and the field is immutable. 70 // constructor and the field is immutable.
73 return SharedBitmap::UncheckedSizeInBytes(size_in_pixels_); 71 return SharedBitmap::UncheckedSizeInBytes(size_in_pixels_);
74 } 72 }
75 73
76 } // namespace cc 74 } // namespace cc
OLDNEW
« no previous file with comments | « cc/resources/texture_mailbox.h ('k') | cc/resources/transferable_resource.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698