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

Side by Side Diff: content/browser/aura/owned_mailbox.cc

Issue 105743004: Add gpu::MailboxHolder to hold state for a gpu::Mailbox (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: cc2a95fe Android fixes. Created 7 years 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
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 "content/browser/aura/owned_mailbox.h" 5 #include "content/browser/aura/owned_mailbox.h"
6 6
7 #include "base/logging.h" 7 #include "base/logging.h"
8 #include "content/browser/aura/image_transport_factory.h" 8 #include "content/browser/aura/image_transport_factory.h"
9 #include "content/common/gpu/client/gl_helper.h" 9 #include "content/common/gpu/client/gl_helper.h"
10 10
11 namespace content { 11 namespace content {
12 12
13 OwnedMailbox::OwnedMailbox(GLHelper* gl_helper) 13 OwnedMailbox::OwnedMailbox(GLHelper* gl_helper)
14 : texture_id_(0), sync_point_(0), gl_helper_(gl_helper) { 14 : texture_id_(0), gl_helper_(gl_helper) {
15 texture_id_ = gl_helper_->CreateTexture(); 15 texture_id_ = gl_helper_->CreateTexture();
16 mailbox_ = gl_helper_->ProduceMailboxFromTexture(texture_id_, &sync_point_); 16 mailbox_holder_ = gl_helper_->ProduceMailboxHolderFromTexture(texture_id_);
17 ImageTransportFactory::GetInstance()->AddObserver(this); 17 ImageTransportFactory::GetInstance()->AddObserver(this);
18 } 18 }
19 19
20 OwnedMailbox::~OwnedMailbox() { 20 OwnedMailbox::~OwnedMailbox() {
21 ImageTransportFactory::GetInstance()->RemoveObserver(this); 21 ImageTransportFactory::GetInstance()->RemoveObserver(this);
22 if (gl_helper_) { 22 if (gl_helper_) {
23 gl_helper_->WaitSyncPoint(sync_point_); 23 gl_helper_->WaitSyncPoint(mailbox_holder_.sync_point());
24 gl_helper_->DeleteTexture(texture_id_); 24 gl_helper_->DeleteTexture(texture_id_);
25 } 25 }
26 } 26 }
27 27
28 void OwnedMailbox::UpdateSyncPoint(uint32 sync_point) { 28 void OwnedMailbox::set_sync_point(uint32 sync_point) {
29 if (sync_point) 29 mailbox_holder_.set_sync_point(sync_point);
piman 2013/12/06 23:29:42 We explicitly don't want to update the sync point
30 sync_point_ = sync_point;
31 } 30 }
32 31
33 void OwnedMailbox::OnLostResources() { 32 void OwnedMailbox::OnLostResources() {
34 gl_helper_->WaitSyncPoint(sync_point_); 33 gl_helper_->WaitSyncPoint(mailbox_holder_.sync_point());
35 gl_helper_->DeleteTexture(texture_id_); 34 gl_helper_->DeleteTexture(texture_id_);
36 texture_id_ = 0; 35 texture_id_ = 0;
37 mailbox_ = gpu::Mailbox(); 36 mailbox_holder_ = gpu::MailboxHolder();
38 sync_point_ = 0;
39 gl_helper_ = NULL; 37 gl_helper_ = NULL;
40 } 38 }
41 39
42 } // namespace content 40 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698