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

Side by Side Diff: cc/texture_mailbox.cc

Issue 12471007: Part 8 of cc/ directory shuffles: resources (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years, 9 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 | Annotate | Revision Log
« no previous file with comments | « cc/texture_mailbox.h ('k') | cc/texture_uploader.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 : sync_point_(0) {
12 }
13
14 TextureMailbox::TextureMailbox(
15 const std::string& mailbox_name,
16 const ReleaseCallback& mailbox_callback)
17 : callback_(mailbox_callback),
18 sync_point_(0) {
19 DCHECK(mailbox_name.empty() == mailbox_callback.is_null());
20 if (!mailbox_name.empty()) {
21 CHECK(mailbox_name.size() == sizeof(name_.name));
22 name_.SetName(reinterpret_cast<const int8*>(mailbox_name.data()));
23 }
24 }
25
26 TextureMailbox::TextureMailbox(
27 const gpu::Mailbox& mailbox_name,
28 const ReleaseCallback& mailbox_callback)
29 : callback_(mailbox_callback),
30 sync_point_(0) {
31 DCHECK(mailbox_name.IsZero() == mailbox_callback.is_null());
32 name_.SetName(mailbox_name.name);
33 }
34
35 TextureMailbox::TextureMailbox(
36 const gpu::Mailbox& mailbox_name,
37 const ReleaseCallback& mailbox_callback,
38 unsigned sync_point)
39 : callback_(mailbox_callback),
40 sync_point_(sync_point) {
41 DCHECK(mailbox_name.IsZero() == mailbox_callback.is_null());
42 name_.SetName(mailbox_name.name);
43 }
44
45 TextureMailbox::~TextureMailbox() {
46 }
47
48 bool TextureMailbox::Equals(const gpu::Mailbox& other) const {
49 return !memcmp(data(), other.name, sizeof(name_.name));
50 }
51
52 bool TextureMailbox::Equals(const TextureMailbox& other) const {
53 return Equals(other.name());
54 }
55
56 bool TextureMailbox::IsEmpty() const {
57 return name_.IsZero();
58 }
59
60 void TextureMailbox::RunReleaseCallback(unsigned sync_point) const {
61 if (!callback_.is_null())
62 callback_.Run(sync_point);
63 }
64
65 void TextureMailbox::SetName(const gpu::Mailbox& other) {
66 name_.SetName(other.name);
67 }
68
69 } // namespace cc
OLDNEW
« no previous file with comments | « cc/texture_mailbox.h ('k') | cc/texture_uploader.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698