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

Unified Diff: third_party/WebKit/Source/platform/base/Bind.h

Issue 1538803002: Migrates battery_status from content/renderer/ to WebKit/platform/ (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Ready for code review Created 4 years, 10 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
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

Powered by Google App Engine
This is Rietveld 408576698