Chromium Code Reviews| 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 RenderWidgetHostViewChildFrame* RenderWidgetHostViewChildFrame::Create( | |
|
clamy
2016/10/05 12:35:53
Please add a // static comment above the method.
dtapuska
2016/10/05 14:25:00
Done.
| |
| 43 RenderWidgetHost* widget) { | |
| 44 RenderWidgetHostViewChildFrame* view = | |
| 45 new RenderWidgetHostViewChildFrame(widget); | |
| 46 view->Init(); | |
| 47 return view; | |
| 48 } | |
| 49 | |
| 42 RenderWidgetHostViewChildFrame::RenderWidgetHostViewChildFrame( | 50 RenderWidgetHostViewChildFrame::RenderWidgetHostViewChildFrame( |
| 43 RenderWidgetHost* widget_host) | 51 RenderWidgetHost* widget_host) |
| 44 : host_(RenderWidgetHostImpl::From(widget_host)), | 52 : host_(RenderWidgetHostImpl::From(widget_host)), |
| 45 frame_sink_id_(AllocateFrameSinkId()), | 53 frame_sink_id_(AllocateFrameSinkId()), |
| 46 next_surface_sequence_(1u), | 54 next_surface_sequence_(1u), |
| 47 last_compositor_frame_sink_id_(0), | 55 last_compositor_frame_sink_id_(0), |
| 48 current_surface_scale_factor_(1.f), | 56 current_surface_scale_factor_(1.f), |
| 49 ack_pending_count_(0), | 57 ack_pending_count_(0), |
| 50 frame_connector_(nullptr), | 58 frame_connector_(nullptr), |
| 51 begin_frame_source_(nullptr), | 59 begin_frame_source_(nullptr), |
| 52 weak_factory_(this) { | 60 weak_factory_(this) { |
| 53 id_allocator_.reset(new cc::SurfaceIdAllocator(frame_sink_id_)); | 61 id_allocator_.reset(new cc::SurfaceIdAllocator(frame_sink_id_)); |
| 54 GetSurfaceManager()->RegisterFrameSinkId(frame_sink_id_); | 62 GetSurfaceManager()->RegisterFrameSinkId(frame_sink_id_); |
| 55 RegisterFrameSinkId(); | 63 RegisterFrameSinkId(); |
| 56 | 64 |
| 57 host_->SetView(this); | |
| 58 GetTextInputManager(); | 65 GetTextInputManager(); |
|
kenrb
2016/10/05 14:10:40
Would it make sense to move these other method cal
dtapuska
2016/10/05 14:25:00
done.
| |
| 59 } | 66 } |
| 60 | 67 |
| 61 RenderWidgetHostViewChildFrame::~RenderWidgetHostViewChildFrame() { | 68 RenderWidgetHostViewChildFrame::~RenderWidgetHostViewChildFrame() { |
| 62 if (!surface_id_.is_null()) | 69 if (!surface_id_.is_null()) |
| 63 surface_factory_->Destroy(surface_id_); | 70 surface_factory_->Destroy(surface_id_); |
| 64 | 71 |
| 65 if (GetSurfaceManager()) | 72 if (GetSurfaceManager()) |
| 66 GetSurfaceManager()->InvalidateFrameSinkId(frame_sink_id_); | 73 GetSurfaceManager()->InvalidateFrameSinkId(frame_sink_id_); |
| 67 } | 74 } |
| 68 | 75 |
| 76 void RenderWidgetHostViewChildFrame::Init() { | |
| 77 host_->SetView(this); | |
| 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 |