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

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

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 | « content/renderer/gpu/compositor_output_surface.h ('k') | no next file » | 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 #include "content/renderer/gpu/compositor_output_surface.h" 5 #include "content/renderer/gpu/compositor_output_surface.h"
6 6
7 #include "base/message_loop_proxy.h" 7 #include "base/message_loop_proxy.h"
8 #include "content/common/view_messages.h" 8 #include "content/common/view_messages.h"
9 #include "content/renderer/render_thread_impl.h" 9 #include "content/renderer/render_thread_impl.h"
10 #include "ipc/ipc_forwarding_message_filter.h" 10 #include "ipc/ipc_forwarding_message_filter.h"
(...skipping 28 matching lines...) Expand all
39 software_device_(software_device) { 39 software_device_(software_device) {
40 DCHECK(output_surface_filter_); 40 DCHECK(output_surface_filter_);
41 capabilities_.hasParentCompositor = false; 41 capabilities_.hasParentCompositor = false;
42 DetachFromThread(); 42 DetachFromThread();
43 } 43 }
44 44
45 CompositorOutputSurface::~CompositorOutputSurface() { 45 CompositorOutputSurface::~CompositorOutputSurface() {
46 DCHECK(CalledOnValidThread()); 46 DCHECK(CalledOnValidThread());
47 if (!client_) 47 if (!client_)
48 return; 48 return;
49 output_surface_proxy_->ClearOutputSurface();
49 output_surface_filter_->RemoveRoute(routing_id_); 50 output_surface_filter_->RemoveRoute(routing_id_);
50 } 51 }
51 52
52 const WebKit::WebCompositorOutputSurface::Capabilities& 53 const WebKit::WebCompositorOutputSurface::Capabilities&
53 CompositorOutputSurface::capabilities() const { 54 CompositorOutputSurface::capabilities() const {
54 DCHECK(CalledOnValidThread()); 55 DCHECK(CalledOnValidThread());
55 return capabilities_; 56 return capabilities_;
56 } 57 }
57 58
58 bool CompositorOutputSurface::bindToClient( 59 bool CompositorOutputSurface::bindToClient(
59 WebKit::WebCompositorOutputSurfaceClient* client) { 60 WebKit::WebCompositorOutputSurfaceClient* client) {
60 DCHECK(CalledOnValidThread()); 61 DCHECK(CalledOnValidThread());
61 DCHECK(!client_); 62 DCHECK(!client_);
62 if (context3D_.get()) { 63 if (context3D_.get()) {
63 if (!context3D_->makeContextCurrent()) 64 if (!context3D_->makeContextCurrent())
64 return false; 65 return false;
65 } 66 }
66 67
67 client_ = client; 68 client_ = client;
68 69
70 output_surface_proxy_ = new CompositorOutputSurfaceProxy(this);
69 output_surface_filter_->AddRoute( 71 output_surface_filter_->AddRoute(
70 routing_id_, 72 routing_id_,
71 base::Bind(&CompositorOutputSurface::OnMessageReceived, 73 base::Bind(&CompositorOutputSurfaceProxy::OnMessageReceived,
72 base::Unretained(this))); 74 output_surface_proxy_));
73 75
74 return true; 76 return true;
75 } 77 }
76 78
77 WebGraphicsContext3D* CompositorOutputSurface::context3D() const { 79 WebGraphicsContext3D* CompositorOutputSurface::context3D() const {
78 DCHECK(CalledOnValidThread()); 80 DCHECK(CalledOnValidThread());
79 return context3D_.get(); 81 return context3D_.get();
80 } 82 }
81 83
82 WebCompositorSoftwareOutputDevice* CompositorOutputSurface::softwareDevice() 84 WebCompositorSoftwareOutputDevice* CompositorOutputSurface::softwareDevice()
(...skipping 20 matching lines...) Expand all
103 base::TimeTicks timebase, 105 base::TimeTicks timebase,
104 base::TimeDelta interval) { 106 base::TimeDelta interval) {
105 DCHECK(CalledOnValidThread()); 107 DCHECK(CalledOnValidThread());
106 DCHECK(client_); 108 DCHECK(client_);
107 double monotonicTimebase = timebase.ToInternalValue() / 109 double monotonicTimebase = timebase.ToInternalValue() /
108 static_cast<double>(base::Time::kMicrosecondsPerSecond); 110 static_cast<double>(base::Time::kMicrosecondsPerSecond);
109 double intervalInSeconds = interval.ToInternalValue() / 111 double intervalInSeconds = interval.ToInternalValue() /
110 static_cast<double>(base::Time::kMicrosecondsPerSecond); 112 static_cast<double>(base::Time::kMicrosecondsPerSecond);
111 client_->onVSyncParametersChanged(monotonicTimebase, intervalInSeconds); 113 client_->onVSyncParametersChanged(monotonicTimebase, intervalInSeconds);
112 } 114 }
OLDNEW
« no previous file with comments | « content/renderer/gpu/compositor_output_surface.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698