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

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

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

Powered by Google App Engine
This is Rietveld 408576698