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

Side by Side Diff: cc/output/texture_mailbox_deleter.cc

Issue 1437413002: cc: Remove ScopedPtrVector and cc::remove_if. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: just the vector Created 5 years, 1 month 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
OLDNEW
1 // Copyright 2013 The Chromium Authors. All rights reserved. 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 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "cc/output/texture_mailbox_deleter.h" 5 #include "cc/output/texture_mailbox_deleter.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/location.h" 8 #include "base/location.h"
9 #include "base/memory/weak_ptr.h" 9 #include "base/memory/weak_ptr.h"
10 #include "base/single_thread_task_runner.h" 10 #include "base/single_thread_task_runner.h"
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after
56 SingleReleaseCallback::Create(base::Bind(&DeleteTextureOnImplThread, 56 SingleReleaseCallback::Create(base::Bind(&DeleteTextureOnImplThread,
57 context_provider, 57 context_provider,
58 texture_id)); 58 texture_id));
59 59
60 impl_callbacks_.push_back(impl_callback.Pass()); 60 impl_callbacks_.push_back(impl_callback.Pass());
61 61
62 // The raw pointer to the impl-side callback is valid as long as this 62 // The raw pointer to the impl-side callback is valid as long as this
63 // class is alive. So we guard it with a WeakPtr. 63 // class is alive. So we guard it with a WeakPtr.
64 ReleaseCallback run_impl_callback( 64 ReleaseCallback run_impl_callback(
65 base::Bind(&TextureMailboxDeleter::RunDeleteTextureOnImplThread, 65 base::Bind(&TextureMailboxDeleter::RunDeleteTextureOnImplThread,
66 weak_ptr_factory_.GetWeakPtr(), 66 weak_ptr_factory_.GetWeakPtr(), impl_callbacks_.back().get()));
67 impl_callbacks_.back()));
68 67
69 // Provide a callback for the main thread that posts back to the impl 68 // Provide a callback for the main thread that posts back to the impl
70 // thread. 69 // thread.
71 scoped_ptr<SingleReleaseCallback> main_callback; 70 scoped_ptr<SingleReleaseCallback> main_callback;
72 if (impl_task_runner_) { 71 if (impl_task_runner_) {
73 main_callback = SingleReleaseCallback::Create(base::Bind( 72 main_callback = SingleReleaseCallback::Create(base::Bind(
74 &PostTaskFromMainToImplThread, impl_task_runner_, run_impl_callback)); 73 &PostTaskFromMainToImplThread, impl_task_runner_, run_impl_callback));
75 } else { 74 } else {
76 main_callback = SingleReleaseCallback::Create(run_impl_callback); 75 main_callback = SingleReleaseCallback::Create(run_impl_callback);
77 } 76 }
(...skipping 12 matching lines...) Expand all
90 impl_callbacks_.erase(impl_callbacks_.begin() + i); 89 impl_callbacks_.erase(impl_callbacks_.begin() + i);
91 return; 90 return;
92 } 91 }
93 } 92 }
94 93
95 NOTREACHED() << "The Callback returned by GetDeleteCallback() was called " 94 NOTREACHED() << "The Callback returned by GetDeleteCallback() was called "
96 << "more than once."; 95 << "more than once.";
97 } 96 }
98 97
99 } // namespace cc 98 } // namespace cc
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698