Index: third_party/WebKit/Source/platform/base/Bind.h |
diff --git a/third_party/WebKit/Source/platform/graphics/paint/DisplayItemList.cpp b/third_party/WebKit/Source/platform/base/Bind.h |
similarity index 24% |
copy from third_party/WebKit/Source/platform/graphics/paint/DisplayItemList.cpp |
copy to third_party/WebKit/Source/platform/base/Bind.h |
index 5d03512db4714a33edb6bac402fcf4367a099d26..21c9a15b849e0ae59d0b93ddc94086e0e55f9810 100644 |
--- a/third_party/WebKit/Source/platform/graphics/paint/DisplayItemList.cpp |
+++ b/third_party/WebKit/Source/platform/base/Bind.h |
@@ -2,22 +2,28 @@ |
// Use of this source code is governed by a BSD-style license that can be |
// found in the LICENSE file. |
-#include "platform/graphics/paint/DisplayItemList.h" |
+#ifndef Bind_h |
+#define Bind_h |
-#include "platform/graphics/paint/PaintChunk.h" |
+#include "base/bind.h" |
+#include "mojo/public/cpp/bindings/callback.h" |
-namespace blink { |
+// This file provides limited access to base::Bind() function. base::Bind() |
+// could be dangerous if it's used across threads, so we don't want to allow |
+// general use of base::Bind(). |
+// See also "platform/ThreadSafeFunctional.h". |
haraken
2016/02/09 12:01:21
I'd move the contents of this file to ThreadSafeFu
Yuki
2016/02/12 12:36:14
We'd like to limit the access to base/bind.h. Not
|
-DisplayItemList::Range<DisplayItemList::iterator> |
-DisplayItemList::itemsInPaintChunk(const PaintChunk& paintChunk) |
-{ |
- return Range<iterator>(begin() + paintChunk.beginIndex, begin() + paintChunk.endIndex); |
-} |
+namespace blink { |
-DisplayItemList::Range<DisplayItemList::const_iterator> |
-DisplayItemList::itemsInPaintChunk(const PaintChunk& paintChunk) const |
+// Binds an instance of a class to its member function. Does not bind anything |
+// else. |
+template<typename Class, typename ReturnType, typename... Args> |
+mojo::Callback<ReturnType(Args...)> |
+bindInstanceToMethodForMojo(ReturnType (Class::*method)(Args...), Class* instance) |
haraken
2016/02/09 12:01:21
tzik@: In your refactoring plan, this method is go
Yuki
2016/02/12 12:36:14
tzik@, is there an easy way to check whether we're
|
{ |
- return Range<const_iterator>(begin() + paintChunk.beginIndex, begin() + paintChunk.endIndex); |
+ return base::Bind(method, base::Unretained(instance)); |
} |
} // namespace blink |
+ |
+#endif // Bind_h |