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

Side by Side Diff: cc/texture_mailbox.cc

Issue 11888010: Cosmetic cleanup to texture_layer mailboxes. (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: Using Mailbox struct Created 7 years, 11 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
(Empty)
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
3 // found in the LICENSE file.
4
5 #include "base/logging.h"
6 #include "cc/texture_mailbox.h"
7
8 namespace cc {
9
10 TextureMailbox::TextureMailbox() {
11 }
12
13 TextureMailbox::TextureMailbox(
14 const std::string& mailbox_name,
15 const ReleaseCallback& mailbox_callback)
16 : callback_(mailbox_callback) {
17 DCHECK(mailbox_name.empty() == mailbox_callback.is_null());
18 if (!mailbox_name.empty()) {
19 DCHECK(mailbox_name.size() == sizeof(name_.name));
piman 2013/01/17 21:30:01 nit: could you make this a CHECK? If the check fai
alexst (slow to review) 2013/01/17 22:10:11 Done.
20 name_.setName(reinterpret_cast<const int8*>(mailbox_name.data()));
21 }
22 }
23
24 TextureMailbox::TextureMailbox(
25 const Mailbox& mailbox_name,
26 const ReleaseCallback& mailbox_callback)
27 : callback_(mailbox_callback) {
28 DCHECK(mailbox_name.isZero() == mailbox_callback.is_null());
29 name_.setName(mailbox_name.name);
30 }
31
32 TextureMailbox::~TextureMailbox() {
33 }
34
35 bool TextureMailbox::Equals(const TextureMailbox& other) const {
36 return !memcmp(data(), other.data(), sizeof(name_.name));
37 }
38
39 bool TextureMailbox::IsEmpty() const {
40 return name_.isZero();
41 }
42
43 void TextureMailbox::RunReleaseCallback(unsigned sync_point) const {
44 if (!callback_.is_null())
45 callback_.Run(sync_point);
46 }
47
48 void TextureMailbox::SetName(const int8* data) {
49 name_.setName(data);
50 }
51
52 } // namespace cc
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698