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

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

Issue 1930193002: cc: Add GpuMemoryBufferHandle to TextureMailbox (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fix exo Created 4 years, 7 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
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 <stddef.h> 7 #include <stddef.h>
8 #include <stdint.h> 8 #include <stdint.h>
9 9
10 #include "base/logging.h" 10 #include "base/logging.h"
(...skipping 13 matching lines...) Expand all
24 24
25 TextureMailbox::TextureMailbox(const gpu::Mailbox& mailbox, 25 TextureMailbox::TextureMailbox(const gpu::Mailbox& mailbox,
26 const gpu::SyncToken& sync_token, 26 const gpu::SyncToken& sync_token,
27 uint32_t target) 27 uint32_t target)
28 : mailbox_holder_(mailbox, sync_token, target), 28 : mailbox_holder_(mailbox, sync_token, target),
29 shared_bitmap_(NULL), 29 shared_bitmap_(NULL),
30 is_overlay_candidate_(false), 30 is_overlay_candidate_(false),
31 secure_output_only_(false), 31 secure_output_only_(false),
32 nearest_neighbor_(false) {} 32 nearest_neighbor_(false) {}
33 33
34 TextureMailbox::TextureMailbox(const gpu::Mailbox& mailbox, 34 TextureMailbox::TextureMailbox(
35 const gpu::SyncToken& sync_token, 35 const gpu::Mailbox& mailbox,
36 uint32_t target, 36 const gpu::SyncToken& sync_token,
37 const gfx::Size& size_in_pixels, 37 uint32_t target,
38 bool is_overlay_candidate, 38 const gfx::Size& size_in_pixels,
39 bool secure_output_only) 39 const gfx::GpuMemoryBufferHandle& gpu_memory_buffer_handle,
40 bool is_overlay_candidate,
41 bool secure_output_only)
40 : mailbox_holder_(mailbox, sync_token, target), 42 : mailbox_holder_(mailbox, sync_token, target),
41 shared_bitmap_(nullptr), 43 shared_bitmap_(nullptr),
42 size_in_pixels_(size_in_pixels), 44 size_in_pixels_(size_in_pixels),
45 gpu_memory_buffer_handle_(gpu_memory_buffer_handle),
43 is_overlay_candidate_(is_overlay_candidate), 46 is_overlay_candidate_(is_overlay_candidate),
44 secure_output_only_(secure_output_only), 47 secure_output_only_(secure_output_only),
45 nearest_neighbor_(false) { 48 nearest_neighbor_(false) {
46 DCHECK(!is_overlay_candidate || !size_in_pixels.IsEmpty()); 49 DCHECK(!is_overlay_candidate || !size_in_pixels.IsEmpty());
47 } 50 }
48 51
49 TextureMailbox::TextureMailbox(SharedBitmap* shared_bitmap, 52 TextureMailbox::TextureMailbox(SharedBitmap* shared_bitmap,
50 const gfx::Size& size_in_pixels) 53 const gfx::Size& size_in_pixels)
51 : shared_bitmap_(shared_bitmap), 54 : shared_bitmap_(shared_bitmap),
52 size_in_pixels_(size_in_pixels), 55 size_in_pixels_(size_in_pixels),
53 is_overlay_candidate_(false), 56 is_overlay_candidate_(false),
54 secure_output_only_(false), 57 secure_output_only_(false),
55 nearest_neighbor_(false) { 58 nearest_neighbor_(false) {
56 // If an embedder of cc gives an invalid TextureMailbox, we should crash 59 // If an embedder of cc gives an invalid TextureMailbox, we should crash
57 // here to identify the offender. 60 // here to identify the offender.
58 CHECK(SharedBitmap::VerifySizeInBytes(size_in_pixels_)); 61 CHECK(SharedBitmap::VerifySizeInBytes(size_in_pixels_));
59 } 62 }
60 63
64 TextureMailbox::TextureMailbox(const TextureMailbox& other)
65 : mailbox_holder_(other.mailbox_holder_),
66 shared_bitmap_(other.shared_bitmap_),
67 size_in_pixels_(other.size_in_pixels_),
68 gpu_memory_buffer_handle_(other.gpu_memory_buffer_handle_),
69 is_overlay_candidate_(other.is_overlay_candidate_),
70 secure_output_only_(other.secure_output_only_),
71 nearest_neighbor_(other.nearest_neighbor_) {}
72
61 TextureMailbox::~TextureMailbox() {} 73 TextureMailbox::~TextureMailbox() {}
62 74
63 bool TextureMailbox::Equals(const TextureMailbox& other) const { 75 bool TextureMailbox::Equals(const TextureMailbox& other) const {
64 if (other.IsTexture()) { 76 if (other.IsTexture()) {
65 return IsTexture() && !memcmp(mailbox_holder_.mailbox.name, 77 return IsTexture() && !memcmp(mailbox_holder_.mailbox.name,
66 other.mailbox_holder_.mailbox.name, 78 other.mailbox_holder_.mailbox.name,
67 sizeof(mailbox_holder_.mailbox.name)); 79 sizeof(mailbox_holder_.mailbox.name));
68 } else if (other.IsSharedMemory()) { 80 } else if (other.IsSharedMemory()) {
69 return IsSharedMemory() && (shared_bitmap_ == other.shared_bitmap_); 81 return IsSharedMemory() && (shared_bitmap_ == other.shared_bitmap_);
70 } 82 }
71 83
72 DCHECK(!other.IsValid()); 84 DCHECK(!other.IsValid());
73 return !IsValid(); 85 return !IsValid();
74 } 86 }
75 87
76 size_t TextureMailbox::SharedMemorySizeInBytes() const { 88 size_t TextureMailbox::SharedMemorySizeInBytes() const {
77 // UncheckedSizeInBytes is okay because we VerifySizeInBytes in the 89 // UncheckedSizeInBytes is okay because we VerifySizeInBytes in the
78 // constructor and the field is immutable. 90 // constructor and the field is immutable.
79 return SharedBitmap::UncheckedSizeInBytes(size_in_pixels_); 91 return SharedBitmap::UncheckedSizeInBytes(size_in_pixels_);
80 } 92 }
81 93
82 } // namespace cc 94 } // namespace cc
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698