OLD | NEW |
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/render_widget.h" | 5 #include "content/renderer/render_widget.h" |
6 | 6 |
7 #include "base/auto_reset.h" | 7 #include "base/auto_reset.h" |
8 #include "base/bind.h" | 8 #include "base/bind.h" |
9 #include "base/command_line.h" | 9 #include "base/command_line.h" |
10 #include "base/debug/trace_event.h" | 10 #include "base/debug/trace_event.h" |
(...skipping 817 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
828 if (routing_id_ != MSG_ROUTING_NONE) { | 828 if (routing_id_ != MSG_ROUTING_NONE) { |
829 if (RenderThreadImpl::current()) | 829 if (RenderThreadImpl::current()) |
830 RenderThreadImpl::current()->WidgetDestroyed(); | 830 RenderThreadImpl::current()->WidgetDestroyed(); |
831 RenderThread::Get()->RemoveRoute(routing_id_); | 831 RenderThread::Get()->RemoveRoute(routing_id_); |
832 SetHidden(false); | 832 SetHidden(false); |
833 } | 833 } |
834 | 834 |
835 // If there is a Send call on the stack, then it could be dangerous to close | 835 // If there is a Send call on the stack, then it could be dangerous to close |
836 // now. Post a task that only gets invoked when there are no nested message | 836 // now. Post a task that only gets invoked when there are no nested message |
837 // loops. | 837 // loops. |
838 base::MessageLoop::current()->PostNonNestableTask( | 838 RenderThread::Get()->GetTaskRunner()->PostNonNestableTask( |
839 FROM_HERE, base::Bind(&RenderWidget::Close, this)); | 839 FROM_HERE, base::Bind(&RenderWidget::Close, this)); |
840 | 840 |
841 // Balances the AddRef taken when we called AddRoute. | 841 // Balances the AddRef taken when we called AddRoute. |
842 Release(); | 842 Release(); |
843 } | 843 } |
844 | 844 |
845 // Got a response from the browser after the renderer decided to create a new | 845 // Got a response from the browser after the renderer decided to create a new |
846 // view. | 846 // view. |
847 void RenderWidget::OnCreatingNewAck() { | 847 void RenderWidget::OnCreatingNewAck() { |
848 DCHECK(routing_id_ != MSG_ROUTING_NONE); | 848 DCHECK(routing_id_ != MSG_ROUTING_NONE); |
(...skipping 651 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1500 } | 1500 } |
1501 | 1501 |
1502 // If a page calls window.close() twice, we'll end up here twice, but that's | 1502 // If a page calls window.close() twice, we'll end up here twice, but that's |
1503 // OK. It is safe to send multiple Close messages. | 1503 // OK. It is safe to send multiple Close messages. |
1504 | 1504 |
1505 // Ask the RenderWidgetHost to initiate close. We could be called from deep | 1505 // Ask the RenderWidgetHost to initiate close. We could be called from deep |
1506 // in Javascript. If we ask the RendwerWidgetHost to close now, the window | 1506 // in Javascript. If we ask the RendwerWidgetHost to close now, the window |
1507 // could be closed before the JS finishes executing. So instead, post a | 1507 // could be closed before the JS finishes executing. So instead, post a |
1508 // message back to the message loop, which won't run until the JS is | 1508 // message back to the message loop, which won't run until the JS is |
1509 // complete, and then the Close message can be sent. | 1509 // complete, and then the Close message can be sent. |
1510 base::MessageLoop::current()->PostTask( | 1510 RenderThread::Get()->GetTaskRunner()->PostTask( |
1511 FROM_HERE, base::Bind(&RenderWidget::DoDeferredClose, this)); | 1511 FROM_HERE, base::Bind(&RenderWidget::DoDeferredClose, this)); |
1512 } | 1512 } |
1513 | 1513 |
1514 void RenderWidget::QueueSyntheticGesture( | 1514 void RenderWidget::QueueSyntheticGesture( |
1515 scoped_ptr<SyntheticGestureParams> gesture_params, | 1515 scoped_ptr<SyntheticGestureParams> gesture_params, |
1516 const SyntheticGestureCompletionCallback& callback) { | 1516 const SyntheticGestureCompletionCallback& callback) { |
1517 DCHECK(!callback.is_null()); | 1517 DCHECK(!callback.is_null()); |
1518 | 1518 |
1519 pending_synthetic_gesture_callbacks_.push(callback); | 1519 pending_synthetic_gesture_callbacks_.push(callback); |
1520 | 1520 |
(...skipping 851 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2372 void RenderWidget::RegisterVideoHoleFrame(RenderFrameImpl* frame) { | 2372 void RenderWidget::RegisterVideoHoleFrame(RenderFrameImpl* frame) { |
2373 video_hole_frames_.AddObserver(frame); | 2373 video_hole_frames_.AddObserver(frame); |
2374 } | 2374 } |
2375 | 2375 |
2376 void RenderWidget::UnregisterVideoHoleFrame(RenderFrameImpl* frame) { | 2376 void RenderWidget::UnregisterVideoHoleFrame(RenderFrameImpl* frame) { |
2377 video_hole_frames_.RemoveObserver(frame); | 2377 video_hole_frames_.RemoveObserver(frame); |
2378 } | 2378 } |
2379 #endif // defined(VIDEO_HOLE) | 2379 #endif // defined(VIDEO_HOLE) |
2380 | 2380 |
2381 } // namespace content | 2381 } // namespace content |
OLD | NEW |