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

Side by Side Diff: trunk/src/content/browser/compositor/owned_mailbox.cc

Issue 137853019: Revert 245131 "Add the UI compositor to the Mac build", which caused Mac ASan redness (Closed) Base URL: svn://svn.chromium.org/chrome/
Patch Set: Created 6 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 | Annotate | Revision Log
OLDNEW
(Empty)
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.
4
5 #include "content/browser/compositor/owned_mailbox.h"
6
7 #include "base/logging.h"
8 #include "content/browser/compositor/image_transport_factory.h"
9 #include "content/common/gpu/client/gl_helper.h"
10
11 namespace content {
12
13 OwnedMailbox::OwnedMailbox(GLHelper* gl_helper)
14 : texture_id_(0), sync_point_(0), gl_helper_(gl_helper) {
15 texture_id_ = gl_helper_->CreateTexture();
16 mailbox_ = gl_helper_->ProduceMailboxFromTexture(texture_id_, &sync_point_);
17 ImageTransportFactory::GetInstance()->AddObserver(this);
18 }
19
20 OwnedMailbox::~OwnedMailbox() {
21 if (gl_helper_)
22 Destroy();
23 }
24
25 void OwnedMailbox::UpdateSyncPoint(uint32 sync_point) {
26 if (sync_point)
27 sync_point_ = sync_point;
28 }
29
30 void OwnedMailbox::Destroy() {
31 ImageTransportFactory::GetInstance()->RemoveObserver(this);
32 gl_helper_->WaitSyncPoint(sync_point_);
33 gl_helper_->DeleteTexture(texture_id_);
34 texture_id_ = 0;
35 mailbox_ = gpu::Mailbox();
36 sync_point_ = 0;
37 gl_helper_ = NULL;
38 }
39
40 void OwnedMailbox::OnLostResources() {
41 if (gl_helper_)
42 Destroy();
43 }
44
45 } // namespace content
OLDNEW
« no previous file with comments | « trunk/src/content/browser/compositor/owned_mailbox.h ('k') | trunk/src/content/browser/compositor/reflector_impl.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698