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

Unified Diff: mojo/public/cpp/bindings/lib/filter_chain.h

Issue 2203243002: Reduce code size of BindingState (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@before-sharing
Patch Set: Address rockot's review comments Created 4 years, 4 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « mojo/public/cpp/bindings/lib/binding_state.cc ('k') | mojo/public/cpp/bindings/lib/filter_chain.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: mojo/public/cpp/bindings/lib/filter_chain.h
diff --git a/mojo/public/cpp/bindings/lib/filter_chain.h b/mojo/public/cpp/bindings/lib/filter_chain.h
index 447be3d136860710b7795b5a60e83c234d99b975..77b8448f794e7431512f70fd917971dc92fe1ea3 100644
--- a/mojo/public/cpp/bindings/lib/filter_chain.h
+++ b/mojo/public/cpp/bindings/lib/filter_chain.h
@@ -28,6 +28,9 @@ class FilterChain {
template <typename FilterType, typename... Args>
inline void Append(Args&&... args);
+ // Takes ownership of |filter|.
+ void Append(MessageFilter* filter);
+
// Doesn't take ownership of |sink|. Therefore |sink| has to stay alive while
// this object is alive.
void SetSink(MessageReceiver* sink);
@@ -50,10 +53,7 @@ class FilterChain {
template <typename FilterType, typename... Args>
inline void FilterChain::Append(Args&&... args) {
- FilterType* filter = new FilterType(std::forward<Args>(args)..., sink_);
- if (!filters_.empty())
- filters_.back()->set_sink(filter);
- filters_.push_back(filter);
+ Append(new FilterType(std::forward<Args>(args)..., sink_));
}
template <>
« no previous file with comments | « mojo/public/cpp/bindings/lib/binding_state.cc ('k') | mojo/public/cpp/bindings/lib/filter_chain.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698