| OLD | NEW |
| 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 21 matching lines...) Expand all Loading... |
| 32 #include "content/common/view_messages.h" | 32 #include "content/common/view_messages.h" |
| 33 #include "content/public/browser/guest_mode.h" | 33 #include "content/public/browser/guest_mode.h" |
| 34 #include "content/public/browser/render_process_host.h" | 34 #include "content/public/browser/render_process_host.h" |
| 35 #include "gpu/ipc/common/gpu_messages.h" | 35 #include "gpu/ipc/common/gpu_messages.h" |
| 36 #include "third_party/WebKit/public/web/WebInputEvent.h" | 36 #include "third_party/WebKit/public/web/WebInputEvent.h" |
| 37 #include "ui/gfx/geometry/size_conversions.h" | 37 #include "ui/gfx/geometry/size_conversions.h" |
| 38 #include "ui/gfx/geometry/size_f.h" | 38 #include "ui/gfx/geometry/size_f.h" |
| 39 | 39 |
| 40 namespace content { | 40 namespace content { |
| 41 | 41 |
| 42 // static |
| 43 RenderWidgetHostViewChildFrame* RenderWidgetHostViewChildFrame::Create( |
| 44 RenderWidgetHost* widget) { |
| 45 RenderWidgetHostViewChildFrame* view = |
| 46 new RenderWidgetHostViewChildFrame(widget); |
| 47 view->Init(); |
| 48 return view; |
| 49 } |
| 50 |
| 42 RenderWidgetHostViewChildFrame::RenderWidgetHostViewChildFrame( | 51 RenderWidgetHostViewChildFrame::RenderWidgetHostViewChildFrame( |
| 43 RenderWidgetHost* widget_host) | 52 RenderWidgetHost* widget_host) |
| 44 : host_(RenderWidgetHostImpl::From(widget_host)), | 53 : host_(RenderWidgetHostImpl::From(widget_host)), |
| 45 frame_sink_id_(AllocateFrameSinkId()), | 54 frame_sink_id_(AllocateFrameSinkId()), |
| 46 next_surface_sequence_(1u), | 55 next_surface_sequence_(1u), |
| 47 last_compositor_frame_sink_id_(0), | 56 last_compositor_frame_sink_id_(0), |
| 48 current_surface_scale_factor_(1.f), | 57 current_surface_scale_factor_(1.f), |
| 49 ack_pending_count_(0), | 58 ack_pending_count_(0), |
| 50 frame_connector_(nullptr), | 59 frame_connector_(nullptr), |
| 51 begin_frame_source_(nullptr), | 60 begin_frame_source_(nullptr), |
| 52 weak_factory_(this) { | 61 weak_factory_(this) { |
| 53 id_allocator_.reset(new cc::SurfaceIdAllocator(frame_sink_id_)); | 62 id_allocator_.reset(new cc::SurfaceIdAllocator(frame_sink_id_)); |
| 54 GetSurfaceManager()->RegisterFrameSinkId(frame_sink_id_); | 63 GetSurfaceManager()->RegisterFrameSinkId(frame_sink_id_); |
| 55 RegisterFrameSinkId(); | |
| 56 | |
| 57 host_->SetView(this); | |
| 58 GetTextInputManager(); | |
| 59 } | 64 } |
| 60 | 65 |
| 61 RenderWidgetHostViewChildFrame::~RenderWidgetHostViewChildFrame() { | 66 RenderWidgetHostViewChildFrame::~RenderWidgetHostViewChildFrame() { |
| 62 if (!surface_id_.is_null()) | 67 if (!surface_id_.is_null()) |
| 63 surface_factory_->Destroy(surface_id_); | 68 surface_factory_->Destroy(surface_id_); |
| 64 | 69 |
| 65 if (GetSurfaceManager()) | 70 if (GetSurfaceManager()) |
| 66 GetSurfaceManager()->InvalidateFrameSinkId(frame_sink_id_); | 71 GetSurfaceManager()->InvalidateFrameSinkId(frame_sink_id_); |
| 67 } | 72 } |
| 68 | 73 |
| 74 void RenderWidgetHostViewChildFrame::Init() { |
| 75 RegisterFrameSinkId(); |
| 76 host_->SetView(this); |
| 77 GetTextInputManager(); |
| 78 } |
| 79 |
| 69 void RenderWidgetHostViewChildFrame::SetCrossProcessFrameConnector( | 80 void RenderWidgetHostViewChildFrame::SetCrossProcessFrameConnector( |
| 70 CrossProcessFrameConnector* frame_connector) { | 81 CrossProcessFrameConnector* frame_connector) { |
| 71 if (frame_connector_ == frame_connector) | 82 if (frame_connector_ == frame_connector) |
| 72 return; | 83 return; |
| 73 | 84 |
| 74 if (frame_connector_) { | 85 if (frame_connector_) { |
| 75 if (!parent_frame_sink_id_.is_null()) { | 86 if (!parent_frame_sink_id_.is_null()) { |
| 76 GetSurfaceManager()->UnregisterFrameSinkHierarchy(parent_frame_sink_id_, | 87 GetSurfaceManager()->UnregisterFrameSinkHierarchy(parent_frame_sink_id_, |
| 77 frame_sink_id_); | 88 frame_sink_id_); |
| 78 } | 89 } |
| (...skipping 634 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 713 | 724 |
| 714 bool RenderWidgetHostViewChildFrame::IsChildFrameForTesting() const { | 725 bool RenderWidgetHostViewChildFrame::IsChildFrameForTesting() const { |
| 715 return true; | 726 return true; |
| 716 } | 727 } |
| 717 | 728 |
| 718 cc::SurfaceId RenderWidgetHostViewChildFrame::SurfaceIdForTesting() const { | 729 cc::SurfaceId RenderWidgetHostViewChildFrame::SurfaceIdForTesting() const { |
| 719 return surface_id_; | 730 return surface_id_; |
| 720 }; | 731 }; |
| 721 | 732 |
| 722 } // namespace content | 733 } // namespace content |
| OLD | NEW |