Commit a4888371 authored by groby@chromium.org's avatar groby@chromium.org

base::Bind fixes


BUG=none
TEST=none


Review URL: http://codereview.chromium.org/8601002

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@110818 0039d316-1c4b-4281-b951-d872f2087c98
parent dc61f78b
...@@ -4,6 +4,7 @@ ...@@ -4,6 +4,7 @@
#include "content/plugin/plugin_channel.h" #include "content/plugin/plugin_channel.h"
#include "base/bind.h"
#include "base/command_line.h" #include "base/command_line.h"
#include "base/process_util.h" #include "base/process_util.h"
#include "base/string_util.h" #include "base/string_util.h"
...@@ -238,8 +239,8 @@ void PluginChannel::OnDestroyInstance(int instance_id, ...@@ -238,8 +239,8 @@ void PluginChannel::OnDestroyInstance(int instance_id,
// Don't release the modal dialog event right away, but do it after the // Don't release the modal dialog event right away, but do it after the
// stack unwinds since the plugin can be destroyed later if it's in use // stack unwinds since the plugin can be destroyed later if it's in use
// right now. // right now.
MessageLoop::current()->PostNonNestableTask(FROM_HERE, NewRunnableMethod( MessageLoop::current()->PostNonNestableTask(FROM_HERE, base::Bind(
filter.get(), &MessageFilter::ReleaseModalDialogEvent, window)); &MessageFilter::ReleaseModalDialogEvent, filter.get(), window));
return; return;
} }
} }
......
...@@ -15,6 +15,7 @@ ...@@ -15,6 +15,7 @@
#include <string> #include <string>
#include <vector> #include <vector>
#include "base/bind.h"
#include "base/command_line.h" #include "base/command_line.h"
#include "base/lazy_instance.h" #include "base/lazy_instance.h"
#include "base/process_util.h" #include "base/process_util.h"
...@@ -54,7 +55,7 @@ class EnsureTerminateMessageFilter : public IPC::ChannelProxy::MessageFilter { ...@@ -54,7 +55,7 @@ class EnsureTerminateMessageFilter : public IPC::ChannelProxy::MessageFilter {
// We achieve this by posting an exit process task on the IO thread. // We achieve this by posting an exit process task on the IO thread.
MessageLoop::current()->PostDelayedTask( MessageLoop::current()->PostDelayedTask(
FROM_HERE, FROM_HERE,
NewRunnableMethod(this, &EnsureTerminateMessageFilter::Terminate), base::Bind(&EnsureTerminateMessageFilter::Terminate, this),
kPluginProcessTerminateTimeoutMs); kPluginProcessTerminateTimeoutMs);
} }
......
...@@ -6,7 +6,7 @@ ...@@ -6,7 +6,7 @@
#include "content/plugin/webplugin_accelerated_surface_proxy_mac.h" #include "content/plugin/webplugin_accelerated_surface_proxy_mac.h"
#include "base/callback_old.h" #include "base/bind.h"
#include "content/plugin/webplugin_proxy.h" #include "content/plugin/webplugin_proxy.h"
#include "ui/gfx/surface/accelerated_surface_mac.h" #include "ui/gfx/surface/accelerated_surface_mac.h"
#include "ui/gfx/surface/transport_dib.h" #include "ui/gfx/surface/transport_dib.h"
...@@ -27,8 +27,10 @@ WebPluginAcceleratedSurfaceProxy::WebPluginAcceleratedSurfaceProxy( ...@@ -27,8 +27,10 @@ WebPluginAcceleratedSurfaceProxy::WebPluginAcceleratedSurfaceProxy(
// Only used for 10.5 support, but harmless on 10.6+. // Only used for 10.5 support, but harmless on 10.6+.
surface_->SetTransportDIBAllocAndFree( surface_->SetTransportDIBAllocAndFree(
NewCallback(plugin_proxy_, &WebPluginProxy::AllocSurfaceDIB), base::Bind(&WebPluginProxy::AllocSurfaceDIB,
NewCallback(plugin_proxy_, &WebPluginProxy::FreeSurfaceDIB)); base::Unretained(plugin_proxy)),
base::Bind(&WebPluginProxy::FreeSurfaceDIB,
base::Unretained(plugin_proxy)));
} }
WebPluginAcceleratedSurfaceProxy::~WebPluginAcceleratedSurfaceProxy() { WebPluginAcceleratedSurfaceProxy::~WebPluginAcceleratedSurfaceProxy() {
......
...@@ -6,6 +6,7 @@ ...@@ -6,6 +6,7 @@
#include "build/build_config.h" #include "build/build_config.h"
#include "base/bind.h"
#include "base/lazy_instance.h" #include "base/lazy_instance.h"
#include "base/memory/scoped_handle.h" #include "base/memory/scoped_handle.h"
#include "base/shared_memory.h" #include "base/shared_memory.h"
...@@ -63,7 +64,7 @@ WebPluginProxy::WebPluginProxy( ...@@ -63,7 +64,7 @@ WebPluginProxy::WebPluginProxy(
transparent_(false), transparent_(false),
windowless_buffer_index_(0), windowless_buffer_index_(0),
host_render_view_routing_id_(host_render_view_routing_id), host_render_view_routing_id_(host_render_view_routing_id),
ALLOW_THIS_IN_INITIALIZER_LIST(runnable_method_factory_(this)) { ALLOW_THIS_IN_INITIALIZER_LIST(weak_factory_(this)) {
#if defined(USE_X11) #if defined(USE_X11)
windowless_shm_pixmaps_[0] = None; windowless_shm_pixmaps_[0] = None;
windowless_shm_pixmaps_[1] = None; windowless_shm_pixmaps_[1] = None;
...@@ -198,8 +199,8 @@ void WebPluginProxy::InvalidateRect(const gfx::Rect& rect) { ...@@ -198,8 +199,8 @@ void WebPluginProxy::InvalidateRect(const gfx::Rect& rect) {
// Invalidates caused by calls to NPN_InvalidateRect/NPN_InvalidateRgn // Invalidates caused by calls to NPN_InvalidateRect/NPN_InvalidateRgn
// need to be painted asynchronously as per the NPAPI spec. // need to be painted asynchronously as per the NPAPI spec.
MessageLoop::current()->PostTask(FROM_HERE, MessageLoop::current()->PostTask(FROM_HERE,
runnable_method_factory_.NewRunnableMethod( base::Bind(&WebPluginProxy::OnPaint, weak_factory_.GetWeakPtr(),
&WebPluginProxy::OnPaint, damaged_rect_)); damaged_rect_));
damaged_rect_ = gfx::Rect(); damaged_rect_ = gfx::Rect();
} }
} }
......
...@@ -278,7 +278,7 @@ class WebPluginProxy : public webkit::npapi::WebPlugin { ...@@ -278,7 +278,7 @@ class WebPluginProxy : public webkit::npapi::WebPlugin {
// Contains the routing id of the host render view. // Contains the routing id of the host render view.
int host_render_view_routing_id_; int host_render_view_routing_id_;
ScopedRunnableMethodFactory<WebPluginProxy> runnable_method_factory_; base::WeakPtrFactory<WebPluginProxy> weak_factory_;
}; };
#endif // CONTENT_PLUGIN_WEBPLUGIN_PROXY_H_ #endif // CONTENT_PLUGIN_WEBPLUGIN_PROXY_H_
...@@ -71,8 +71,8 @@ void AcceleratedSurface::Destroy() { ...@@ -71,8 +71,8 @@ void AcceleratedSurface::Destroy() {
// these objects. // these objects.
// Release the old TransportDIB in the browser. // Release the old TransportDIB in the browser.
if (dib_free_callback_.get() && transport_dib_.get()) { if (!dib_free_callback_.is_null() && transport_dib_.get()) {
dib_free_callback_->Run(transport_dib_->id()); dib_free_callback_.Run(transport_dib_->id());
} }
transport_dib_.reset(); transport_dib_.reset();
...@@ -331,8 +331,8 @@ TransportDIB::Handle AcceleratedSurface::SetTransportDIBSize( ...@@ -331,8 +331,8 @@ TransportDIB::Handle AcceleratedSurface::SetTransportDIBSize(
real_surface_size_ = clamped_size; real_surface_size_ = clamped_size;
// Release the old TransportDIB in the browser. // Release the old TransportDIB in the browser.
if (dib_free_callback_.get() && transport_dib_.get()) { if (!dib_free_callback_.is_null() && transport_dib_.get()) {
dib_free_callback_->Run(transport_dib_->id()); dib_free_callback_.Run(transport_dib_->id());
} }
transport_dib_.reset(); transport_dib_.reset();
...@@ -340,8 +340,8 @@ TransportDIB::Handle AcceleratedSurface::SetTransportDIBSize( ...@@ -340,8 +340,8 @@ TransportDIB::Handle AcceleratedSurface::SetTransportDIBSize(
size_t dib_size = size_t dib_size =
clamped_size.width() * 4 * clamped_size.height(); // 4 bytes per pixel. clamped_size.width() * 4 * clamped_size.height(); // 4 bytes per pixel.
TransportDIB::Handle dib_handle; TransportDIB::Handle dib_handle;
if (dib_alloc_callback_.get()) { if (!dib_alloc_callback_.is_null()) {
dib_alloc_callback_->Run(dib_size, &dib_handle); dib_alloc_callback_.Run(dib_size, &dib_handle);
} }
if (!TransportDIB::is_valid_handle(dib_handle)) { if (!TransportDIB::is_valid_handle(dib_handle)) {
// If the allocator fails, it means the DIB was not created in the browser, // If the allocator fails, it means the DIB was not created in the browser,
...@@ -376,8 +376,8 @@ TransportDIB::Handle AcceleratedSurface::SetTransportDIBSize( ...@@ -376,8 +376,8 @@ TransportDIB::Handle AcceleratedSurface::SetTransportDIBSize(
} }
void AcceleratedSurface::SetTransportDIBAllocAndFree( void AcceleratedSurface::SetTransportDIBAllocAndFree(
Callback2<size_t, TransportDIB::Handle*>::Type* allocator, const base::Callback<void(size_t, TransportDIB::Handle*)>& allocator,
Callback1<TransportDIB::Id>::Type* deallocator) { const base::Callback<void(TransportDIB::Id)>& deallocator) {
dib_alloc_callback_.reset(allocator); dib_alloc_callback_ = allocator;
dib_free_callback_.reset(deallocator); dib_free_callback_ = deallocator;
} }
...@@ -8,7 +8,7 @@ ...@@ -8,7 +8,7 @@
#include <CoreFoundation/CoreFoundation.h> #include <CoreFoundation/CoreFoundation.h>
#include "base/callback_old.h" #include "base/bind.h"
#include "base/mac/scoped_cftyperef.h" #include "base/mac/scoped_cftyperef.h"
#include "base/memory/scoped_ptr.h" #include "base/memory/scoped_ptr.h"
#include "ui/gfx/gl/gl_context.h" #include "ui/gfx/gl/gl_context.h"
...@@ -112,8 +112,8 @@ class SURFACE_EXPORT AcceleratedSurface { ...@@ -112,8 +112,8 @@ class SURFACE_EXPORT AcceleratedSurface {
// Sets the methods to use for allocating and freeing memory for the // Sets the methods to use for allocating and freeing memory for the
// transport DIB. // transport DIB.
void SetTransportDIBAllocAndFree( void SetTransportDIBAllocAndFree(
Callback2<size_t, TransportDIB::Handle*>::Type* allocator, const base::Callback<void(size_t, TransportDIB::Handle*)>& allocator,
Callback1<TransportDIB::Id>::Type* deallocator); const base::Callback<void(TransportDIB::Id)>& deallocator);
// Get the accelerated surface size. // Get the accelerated surface size.
gfx::Size GetSize() const { return surface_size_; } gfx::Size GetSize() const { return surface_size_; }
...@@ -175,9 +175,8 @@ class SURFACE_EXPORT AcceleratedSurface { ...@@ -175,9 +175,8 @@ class SURFACE_EXPORT AcceleratedSurface {
GLuint fbo_; GLuint fbo_;
GLuint depth_stencil_renderbuffer_; GLuint depth_stencil_renderbuffer_;
// Allocate a TransportDIB in the renderer. // Allocate a TransportDIB in the renderer.
scoped_ptr<Callback2<size_t, TransportDIB::Handle*>::Type> base::Callback<void(size_t, TransportDIB::Handle*)> dib_alloc_callback_;
dib_alloc_callback_; base::Callback<void(TransportDIB::Id)> dib_free_callback_;
scoped_ptr<Callback1<TransportDIB::Id>::Type> dib_free_callback_;
}; };
#endif // UI_GFX_SURFACE_ACCELERATED_SURFACE_MAC_H_ #endif // UI_GFX_SURFACE_ACCELERATED_SURFACE_MAC_H_
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment