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

Side by Side Diff: content/renderer/gpu/compositor_output_surface.h

Issue 11044008: Dont let messages hit CompositorOutputSurface after it is destroyed. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 8 years, 2 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « no previous file | content/renderer/gpu/compositor_output_surface.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #ifndef CONTENT_RENDERER_GPU_COMPOSITOR_OUTPUT_SURFACE_H_ 5 #ifndef CONTENT_RENDERER_GPU_COMPOSITOR_OUTPUT_SURFACE_H_
6 #define CONTENT_RENDERER_GPU_COMPOSITOR_OUTPUT_SURFACE_H_ 6 #define CONTENT_RENDERER_GPU_COMPOSITOR_OUTPUT_SURFACE_H_
7 7
8 #include "base/basictypes.h" 8 #include "base/basictypes.h"
9 #include "base/compiler_specific.h" 9 #include "base/compiler_specific.h"
10 #include "base/memory/ref_counted.h"
10 #include "base/memory/scoped_ptr.h" 11 #include "base/memory/scoped_ptr.h"
11 #include "base/memory/ref_counted.h"
12 #include "base/threading/non_thread_safe.h" 12 #include "base/threading/non_thread_safe.h"
13 #include "base/time.h" 13 #include "base/time.h"
14 #include "third_party/WebKit/Source/Platform/chromium/public/WebCompositorOutput Surface.h" 14 #include "third_party/WebKit/Source/Platform/chromium/public/WebCompositorOutput Surface.h"
15 #include "third_party/WebKit/Source/Platform/chromium/public/WebCompositorSoftwa reOutputDevice.h" 15 #include "third_party/WebKit/Source/Platform/chromium/public/WebCompositorSoftwa reOutputDevice.h"
16 16
17 namespace base { 17 namespace base {
18 class TaskRunner; 18 class TaskRunner;
19 } 19 }
20 20
21 namespace IPC { 21 namespace IPC {
(...skipping 19 matching lines...) Expand all
41 // WebCompositorOutputSurface implementation. 41 // WebCompositorOutputSurface implementation.
42 virtual bool bindToClient( 42 virtual bool bindToClient(
43 WebKit::WebCompositorOutputSurfaceClient* client) OVERRIDE; 43 WebKit::WebCompositorOutputSurfaceClient* client) OVERRIDE;
44 virtual const Capabilities& capabilities() const OVERRIDE; 44 virtual const Capabilities& capabilities() const OVERRIDE;
45 virtual WebKit::WebGraphicsContext3D* context3D() const OVERRIDE; 45 virtual WebKit::WebGraphicsContext3D* context3D() const OVERRIDE;
46 virtual WebKit::WebCompositorSoftwareOutputDevice* softwareDevice() const; 46 virtual WebKit::WebCompositorSoftwareOutputDevice* softwareDevice() const;
47 virtual void sendFrameToParentCompositor( 47 virtual void sendFrameToParentCompositor(
48 const WebKit::WebCompositorFrame&) OVERRIDE; 48 const WebKit::WebCompositorFrame&) OVERRIDE;
49 49
50 private: 50 private:
51 class CompositorOutputSurfaceProxy :
52 public base::RefCountedThreadSafe<CompositorOutputSurfaceProxy> {
53 public:
54 explicit CompositorOutputSurfaceProxy(
55 CompositorOutputSurface* output_surface)
56 : output_surface_(output_surface) {}
57 void ClearOutputSurface() { output_surface_ = NULL; }
58 void OnMessageReceived(const IPC::Message& message) {
59 if (output_surface_)
60 output_surface_->OnMessageReceived(message);
61 }
62
63 private:
64 friend class base::RefCountedThreadSafe<CompositorOutputSurfaceProxy>;
65 ~CompositorOutputSurfaceProxy() {}
66 CompositorOutputSurface* output_surface_;
67
68 DISALLOW_COPY_AND_ASSIGN(CompositorOutputSurfaceProxy);
69 };
70
51 void OnMessageReceived(const IPC::Message& message); 71 void OnMessageReceived(const IPC::Message& message);
52 void OnUpdateVSyncParameters( 72 void OnUpdateVSyncParameters(
53 base::TimeTicks timebase, base::TimeDelta interval); 73 base::TimeTicks timebase, base::TimeDelta interval);
54 74
55 scoped_refptr<IPC::ForwardingMessageFilter> output_surface_filter_; 75 scoped_refptr<IPC::ForwardingMessageFilter> output_surface_filter_;
56 WebKit::WebCompositorOutputSurfaceClient* client_; 76 WebKit::WebCompositorOutputSurfaceClient* client_;
77 scoped_refptr<CompositorOutputSurfaceProxy> output_surface_proxy_;
57 int routing_id_; 78 int routing_id_;
58 Capabilities capabilities_; 79 Capabilities capabilities_;
59 scoped_ptr<WebKit::WebGraphicsContext3D> context3D_; 80 scoped_ptr<WebKit::WebGraphicsContext3D> context3D_;
60 scoped_ptr<WebKit::WebCompositorSoftwareOutputDevice> software_device_; 81 scoped_ptr<WebKit::WebCompositorSoftwareOutputDevice> software_device_;
61 }; 82 };
62 83
63 #endif // CONTENT_RENDERER_GPU_COMPOSITOR_OUTPUT_SURFACE_H_ 84 #endif // CONTENT_RENDERER_GPU_COMPOSITOR_OUTPUT_SURFACE_H_
OLDNEW
« no previous file with comments | « no previous file | content/renderer/gpu/compositor_output_surface.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698