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

Unified Diff: cc/resources/texture_mailbox_deleter.h

Issue 1531403002: Revert "Delete CC." (Closed) Base URL: https://github.com/domokit/mojo.git@master
Patch Set: Created 5 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 side-by-side diff with in-line comments
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 »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: cc/resources/texture_mailbox_deleter.h
diff --git a/cc/resources/texture_mailbox_deleter.h b/cc/resources/texture_mailbox_deleter.h
new file mode 100644
index 0000000000000000000000000000000000000000..e82810a5001d86b1a2ac99ca84c19800776eb635
--- /dev/null
+++ b/cc/resources/texture_mailbox_deleter.h
@@ -0,0 +1,50 @@
+// Copyright 2013 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef CC_RESOURCES_TEXTURE_MAILBOX_DELETER_H_
+#define CC_RESOURCES_TEXTURE_MAILBOX_DELETER_H_
+
+#include "base/memory/weak_ptr.h"
+#include "cc/base/scoped_ptr_vector.h"
+
+namespace base {
+class SingleThreadTaskRunner;
+}
+
+namespace cc {
+class ContextProvider;
+class SingleReleaseCallback;
+
+class TextureMailboxDeleter {
+ public:
+ explicit TextureMailboxDeleter(
+ const scoped_refptr<base::SingleThreadTaskRunner>& task_runner);
+ ~TextureMailboxDeleter();
+
+ // Returns a Callback that can be used as the ReleaseCallback for a
+ // TextureMailbox attached to the |texture_id|. The ReleaseCallback can
+ // be passed to other threads and will destroy the texture, once it is
+ // run, on the impl thread. If the TextureMailboxDeleter is destroyed
+ // due to the compositor shutting down, then the ReleaseCallback will
+ // become a no-op and the texture will be deleted immediately on the
+ // impl thread, along with dropping the reference to the ContextProvider.
+ scoped_ptr<SingleReleaseCallback> GetReleaseCallback(
+ const scoped_refptr<ContextProvider>& context_provider,
+ unsigned texture_id);
+
+ private:
+ // Runs the |impl_callback| to delete the texture and removes the callback
+ // from the |impl_callbacks_| list.
+ void RunDeleteTextureOnImplThread(SingleReleaseCallback* impl_callback,
+ uint32 sync_point,
+ bool is_lost);
+
+ scoped_refptr<base::SingleThreadTaskRunner> impl_task_runner_;
+ ScopedPtrVector<SingleReleaseCallback> impl_callbacks_;
+ base::WeakPtrFactory<TextureMailboxDeleter> weak_ptr_factory_;
+};
+
+} // namespace cc
+
+#endif // CC_RESOURCES_TEXTURE_MAILBOX_DELETER_H_
« 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