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

Side by Side Diff: cc/resources/texture_mailbox_deleter.h

Issue 1535833002: Delete CC. (Closed) Base URL: git@github.com:domokit/mojo.git@moz-5
Patch Set: rebase Created 4 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
« no previous file with comments | « cc/resources/texture_mailbox.cc ('k') | cc/resources/texture_mailbox_deleter.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 #ifndef CC_RESOURCES_TEXTURE_MAILBOX_DELETER_H_
6 #define CC_RESOURCES_TEXTURE_MAILBOX_DELETER_H_
7
8 #include "base/memory/weak_ptr.h"
9 #include "cc/base/scoped_ptr_vector.h"
10
11 namespace base {
12 class SingleThreadTaskRunner;
13 }
14
15 namespace cc {
16 class ContextProvider;
17 class SingleReleaseCallback;
18
19 class TextureMailboxDeleter {
20 public:
21 explicit TextureMailboxDeleter(
22 const scoped_refptr<base::SingleThreadTaskRunner>& task_runner);
23 ~TextureMailboxDeleter();
24
25 // Returns a Callback that can be used as the ReleaseCallback for a
26 // TextureMailbox attached to the |texture_id|. The ReleaseCallback can
27 // be passed to other threads and will destroy the texture, once it is
28 // run, on the impl thread. If the TextureMailboxDeleter is destroyed
29 // due to the compositor shutting down, then the ReleaseCallback will
30 // become a no-op and the texture will be deleted immediately on the
31 // impl thread, along with dropping the reference to the ContextProvider.
32 scoped_ptr<SingleReleaseCallback> GetReleaseCallback(
33 const scoped_refptr<ContextProvider>& context_provider,
34 unsigned texture_id);
35
36 private:
37 // Runs the |impl_callback| to delete the texture and removes the callback
38 // from the |impl_callbacks_| list.
39 void RunDeleteTextureOnImplThread(SingleReleaseCallback* impl_callback,
40 uint32 sync_point,
41 bool is_lost);
42
43 scoped_refptr<base::SingleThreadTaskRunner> impl_task_runner_;
44 ScopedPtrVector<SingleReleaseCallback> impl_callbacks_;
45 base::WeakPtrFactory<TextureMailboxDeleter> weak_ptr_factory_;
46 };
47
48 } // namespace cc
49
50 #endif // CC_RESOURCES_TEXTURE_MAILBOX_DELETER_H_
OLDNEW
« no previous file with comments | « cc/resources/texture_mailbox.cc ('k') | cc/resources/texture_mailbox_deleter.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698