1 // Copyright 2014 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.
5 #include "content/browser/compositor/owned_mailbox.h"
7 #include "base/logging.h"
8 #include "content/browser/compositor/image_transport_factory.h"
9 #include "content/common/gpu/client/gl_helper.h"
13 OwnedMailbox::OwnedMailbox(GLHelper
* gl_helper
)
14 : texture_id_(0), gl_helper_(gl_helper
) {
15 texture_id_
= gl_helper_
->CreateTexture();
16 mailbox_holder_
= gl_helper_
->ProduceMailboxHolderFromTexture(texture_id_
);
17 ImageTransportFactory::GetInstance()->AddObserver(this);
20 OwnedMailbox::~OwnedMailbox() {
25 void OwnedMailbox::UpdateSyncPoint(uint32 sync_point
) {
27 mailbox_holder_
.sync_point
= sync_point
;
30 void OwnedMailbox::Destroy() {
31 ImageTransportFactory::GetInstance()->RemoveObserver(this);
32 gl_helper_
->WaitSyncPoint(mailbox_holder_
.sync_point
);
33 gl_helper_
->DeleteTexture(texture_id_
);
35 mailbox_holder_
= gpu::MailboxHolder();
39 void OwnedMailbox::OnLostResources() {
44 } // namespace content