Index: content/common/gpu/gpu_channel_manager.h |
diff --git a/content/common/gpu/gpu_channel_manager.h b/content/common/gpu/gpu_channel_manager.h |
index 4d18306a38f297bad502ebbb4429438b8d3a4443..4ea32bb4b8553c5f2dcaa3d73affed76dc9dfe27 100644 |
--- a/content/common/gpu/gpu_channel_manager.h |
+++ b/content/common/gpu/gpu_channel_manager.h |
@@ -81,8 +81,6 @@ class GpuChannelManager : public IPC::Listener, |
void LoseAllContexts(); |
- base::WeakPtrFactory<GpuChannelManager> weak_factory_; |
- |
int GenerateRouteID(); |
void AddRoute(int32 routing_id, IPC::Listener* listener); |
void RemoveRoute(int32 routing_id); |
@@ -153,6 +151,11 @@ class GpuChannelManager : public IPC::Listener, |
IPC::SyncChannel* channel_; |
scoped_refptr<IPC::MessageFilter> filter_; |
+ // Member variables should appear before the WeakPtrFactory, to ensure |
+ // that any WeakPtrs to Controller are invalidated before its members |
+ // variable's destructors are executed, rendering them invalid. |
+ base::WeakPtrFactory<GpuChannelManager> weak_factory_; |
+ |
DISALLOW_COPY_AND_ASSIGN(GpuChannelManager); |
}; |