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

Side by Side Diff: content/browser/frame_host/render_widget_host_view_child_frame.cc

Issue 1711103002: Implement lifetime observer on RenderWidgetHostViewBase. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebased to r378132. Created 4 years, 9 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
« no previous file with comments | « no previous file | content/browser/frame_host/render_widget_host_view_guest.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 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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/browser/frame_host/render_widget_host_view_child_frame.h" 5 #include "content/browser/frame_host/render_widget_host_view_child_frame.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 #include <utility> 8 #include <utility>
9 #include <vector> 9 #include <vector>
10 10
(...skipping 185 matching lines...) Expand 10 before | Expand all | Expand 10 after
196 196
197 void RenderWidgetHostViewChildFrame::RenderProcessGone( 197 void RenderWidgetHostViewChildFrame::RenderProcessGone(
198 base::TerminationStatus status, 198 base::TerminationStatus status,
199 int error_code) { 199 int error_code) {
200 if (frame_connector_) 200 if (frame_connector_)
201 frame_connector_->RenderProcessGone(); 201 frame_connector_->RenderProcessGone();
202 Destroy(); 202 Destroy();
203 } 203 }
204 204
205 void RenderWidgetHostViewChildFrame::Destroy() { 205 void RenderWidgetHostViewChildFrame::Destroy() {
206 // SurfaceIdNamespaces registered with RenderWidgetHostInputEventRouter
207 // have already been cleared when RenderWidgetHostViewBase notified its
208 // observers of our impending destruction.
206 if (frame_connector_) { 209 if (frame_connector_) {
207 frame_connector_->set_view(NULL); 210 frame_connector_->set_view(NULL);
208 frame_connector_ = NULL; 211 frame_connector_ = NULL;
209 } 212 }
210 213
211 if (host_->delegate() && host_->delegate()->GetInputEventRouter()) { 214 // We notify our observers about shutdown here since we are about to release
212 host_->delegate()->GetInputEventRouter()->RemoveSurfaceIdNamespaceOwner( 215 // host_ and do not want any event calls coming from
213 GetSurfaceIdNamespace()); 216 // RenderWidgetHostInputEventRouter afterwards.
214 } 217 NotifyObserversAboutShutdown();
215 218
216 host_->SetView(NULL); 219 host_->SetView(NULL);
217 host_ = NULL; 220 host_ = NULL;
218 base::MessageLoop::current()->DeleteSoon(FROM_HERE, this); 221 base::MessageLoop::current()->DeleteSoon(FROM_HERE, this);
219 } 222 }
220 223
221 void RenderWidgetHostViewChildFrame::SetTooltipText( 224 void RenderWidgetHostViewChildFrame::SetTooltipText(
222 const base::string16& tooltip_text) { 225 const base::string16& tooltip_text) {
223 } 226 }
224 227
(...skipping 131 matching lines...) Expand 10 before | Expand all | Expand 10 after
356 359
357 void RenderWidgetHostViewChildFrame::UnlockMouse() { 360 void RenderWidgetHostViewChildFrame::UnlockMouse() {
358 } 361 }
359 362
360 uint32_t RenderWidgetHostViewChildFrame::GetSurfaceIdNamespace() { 363 uint32_t RenderWidgetHostViewChildFrame::GetSurfaceIdNamespace() {
361 return id_allocator_->id_namespace(); 364 return id_allocator_->id_namespace();
362 } 365 }
363 366
364 void RenderWidgetHostViewChildFrame::ProcessKeyboardEvent( 367 void RenderWidgetHostViewChildFrame::ProcessKeyboardEvent(
365 const NativeWebKeyboardEvent& event) { 368 const NativeWebKeyboardEvent& event) {
366 if (!host_)
367 return;
368
369 host_->ForwardKeyboardEvent(event); 369 host_->ForwardKeyboardEvent(event);
370 } 370 }
371 371
372 void RenderWidgetHostViewChildFrame::ProcessMouseEvent( 372 void RenderWidgetHostViewChildFrame::ProcessMouseEvent(
373 const blink::WebMouseEvent& event) { 373 const blink::WebMouseEvent& event) {
374 if (!host_)
375 return;
376
377 host_->ForwardMouseEvent(event); 374 host_->ForwardMouseEvent(event);
378 } 375 }
379 376
380 void RenderWidgetHostViewChildFrame::ProcessMouseWheelEvent( 377 void RenderWidgetHostViewChildFrame::ProcessMouseWheelEvent(
381 const blink::WebMouseWheelEvent& event) { 378 const blink::WebMouseWheelEvent& event) {
382 if (!host_)
383 return;
384
385 if (event.deltaX != 0 || event.deltaY != 0) 379 if (event.deltaX != 0 || event.deltaY != 0)
386 host_->ForwardWheelEvent(event); 380 host_->ForwardWheelEvent(event);
387 } 381 }
388 382
389 gfx::Point RenderWidgetHostViewChildFrame::TransformPointToRootCoordSpace( 383 gfx::Point RenderWidgetHostViewChildFrame::TransformPointToRootCoordSpace(
390 const gfx::Point& point) { 384 const gfx::Point& point) {
391 if (!frame_connector_) 385 if (!frame_connector_)
392 return point; 386 return point;
393 387
394 return frame_connector_->TransformPointToRootCoordSpace(point, surface_id_); 388 return frame_connector_->TransformPointToRootCoordSpace(point, surface_id_);
(...skipping 136 matching lines...) Expand 10 before | Expand all | Expand 10 after
531 if (surface_factory_ && !surface_id_.is_null()) 525 if (surface_factory_ && !surface_id_.is_null())
532 surface_factory_->Destroy(surface_id_); 526 surface_factory_->Destroy(surface_id_);
533 surface_id_ = cc::SurfaceId(); 527 surface_id_ = cc::SurfaceId();
534 } 528 }
535 529
536 cc::SurfaceId RenderWidgetHostViewChildFrame::SurfaceIdForTesting() const { 530 cc::SurfaceId RenderWidgetHostViewChildFrame::SurfaceIdForTesting() const {
537 return surface_id_; 531 return surface_id_;
538 }; 532 };
539 533
540 } // namespace content 534 } // namespace content
OLDNEW
« no previous file with comments | « no previous file | content/browser/frame_host/render_widget_host_view_guest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698