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 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
43 : host_(RenderWidgetHostImpl::From(widget_host)), | 43 : host_(RenderWidgetHostImpl::From(widget_host)), |
44 next_surface_sequence_(1u), | 44 next_surface_sequence_(1u), |
45 last_output_surface_id_(0), | 45 last_output_surface_id_(0), |
46 current_surface_scale_factor_(1.f), | 46 current_surface_scale_factor_(1.f), |
47 ack_pending_count_(0), | 47 ack_pending_count_(0), |
48 frame_connector_(nullptr), | 48 frame_connector_(nullptr), |
49 begin_frame_source_(nullptr), | 49 begin_frame_source_(nullptr), |
50 observing_begin_frame_source_(false), | 50 observing_begin_frame_source_(false), |
51 parent_surface_client_id_(0), | 51 parent_surface_client_id_(0), |
52 weak_factory_(this) { | 52 weak_factory_(this) { |
53 id_allocator_ = CreateSurfaceIdAllocator(); | 53 id_allocator_.reset(new cc::SurfaceIdAllocator(AllocateSurfaceClientId())); |
| 54 GetSurfaceManager()->RegisterSurfaceClientId(id_allocator_->client_id()); |
54 RegisterSurfaceNamespaceId(); | 55 RegisterSurfaceNamespaceId(); |
55 | 56 |
56 host_->SetView(this); | 57 host_->SetView(this); |
57 } | 58 } |
58 | 59 |
59 RenderWidgetHostViewChildFrame::~RenderWidgetHostViewChildFrame() { | 60 RenderWidgetHostViewChildFrame::~RenderWidgetHostViewChildFrame() { |
60 if (!surface_id_.is_null()) | 61 if (!surface_id_.is_null()) |
61 surface_factory_->Destroy(surface_id_); | 62 surface_factory_->Destroy(surface_id_); |
| 63 |
| 64 if (GetSurfaceManager()) |
| 65 GetSurfaceManager()->InvalidateSurfaceClientId(id_allocator_->client_id()); |
62 } | 66 } |
63 | 67 |
64 void RenderWidgetHostViewChildFrame::SetCrossProcessFrameConnector( | 68 void RenderWidgetHostViewChildFrame::SetCrossProcessFrameConnector( |
65 CrossProcessFrameConnector* frame_connector) { | 69 CrossProcessFrameConnector* frame_connector) { |
66 if (frame_connector_ == frame_connector) | 70 if (frame_connector_ == frame_connector) |
67 return; | 71 return; |
68 | 72 |
69 if (frame_connector_) { | 73 if (frame_connector_) { |
70 if (parent_surface_client_id_) { | 74 if (parent_surface_client_id_) { |
71 GetSurfaceManager()->UnregisterSurfaceNamespaceHierarchy( | 75 GetSurfaceManager()->UnregisterSurfaceNamespaceHierarchy( |
(...skipping 598 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
670 | 674 |
671 bool RenderWidgetHostViewChildFrame::IsChildFrameForTesting() const { | 675 bool RenderWidgetHostViewChildFrame::IsChildFrameForTesting() const { |
672 return true; | 676 return true; |
673 } | 677 } |
674 | 678 |
675 cc::SurfaceId RenderWidgetHostViewChildFrame::SurfaceIdForTesting() const { | 679 cc::SurfaceId RenderWidgetHostViewChildFrame::SurfaceIdForTesting() const { |
676 return surface_id_; | 680 return surface_id_; |
677 }; | 681 }; |
678 | 682 |
679 } // namespace content | 683 } // namespace content |
OLD | NEW |