Chromium Code Reviews| Index: third_party/WebKit/Source/platform/base/Bind.h |
| diff --git a/third_party/WebKit/Source/core/css/cssom/ScaleTransformComponent.cpp b/third_party/WebKit/Source/platform/base/Bind.h |
| similarity index 24% |
| copy from third_party/WebKit/Source/core/css/cssom/ScaleTransformComponent.cpp |
| copy to third_party/WebKit/Source/platform/base/Bind.h |
| index 7373fa189f1097a812490cd7ed2a28ea8e931eef..21c9a15b849e0ae59d0b93ddc94086e0e55f9810 100644 |
| --- a/third_party/WebKit/Source/core/css/cssom/ScaleTransformComponent.cpp |
| +++ b/third_party/WebKit/Source/platform/base/Bind.h |
| @@ -2,23 +2,28 @@ |
| // Use of this source code is governed by a BSD-style license that can be |
| // found in the LICENSE file. |
| -#include "core/css/cssom/ScaleTransformComponent.h" |
| +#ifndef Bind_h |
| +#define Bind_h |
|
haraken
2016/02/15 13:18:39
(Nit: I'm not really happy that Blink's threading
Yuki
2016/02/16 07:31:58
Acknowledged.
|
| -#include "core/css/CSSPrimitiveValue.h" |
| -#include "core/css/CSSValuePool.h" |
| +#include "base/bind.h" |
| +#include "mojo/public/cpp/bindings/callback.h" |
| + |
| +// 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". |
| namespace blink { |
| -PassRefPtrWillBeRawPtr<CSSFunctionValue> ScaleTransformComponent::toCSSValue() 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/15 13:18:39
sameThreadBindForMojo ? (Assuming that tzik@ is in
Yuki
2016/02/16 07:31:58
Done.
|
| { |
| - RefPtrWillBeRawPtr<CSSFunctionValue> result = CSSFunctionValue::create(m_is2D ? CSSValueScale : CSSValueScale3d); |
| - |
| - result->append(cssValuePool().createValue(m_x, CSSPrimitiveValue::UnitType::Number)); |
| - result->append(cssValuePool().createValue(m_y, CSSPrimitiveValue::UnitType::Number)); |
| - if (!m_is2D) |
| - result->append(cssValuePool().createValue(m_z, CSSPrimitiveValue::UnitType::Number)); |
| - |
| - return result.release(); |
| + return base::Bind(method, base::Unretained(instance)); |
| } |
| } // namespace blink |
| + |
| +#endif // Bind_h |