| OLD | NEW |
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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 "blimp/client/core/compositor/blimp_compositor.h" | 5 #include "blimp/client/core/compositor/blimp_compositor.h" |
| 6 | 6 |
| 7 #include "base/bind_helpers.h" | 7 #include "base/bind_helpers.h" |
| 8 #include "base/command_line.h" | 8 #include "base/command_line.h" |
| 9 #include "base/memory/ptr_util.h" | 9 #include "base/memory/ptr_util.h" |
| 10 #include "base/metrics/histogram_macros.h" | 10 #include "base/metrics/histogram_macros.h" |
| (...skipping 23 matching lines...) Expand all Loading... |
| 34 | 34 |
| 35 namespace blimp { | 35 namespace blimp { |
| 36 namespace client { | 36 namespace client { |
| 37 | 37 |
| 38 namespace { | 38 namespace { |
| 39 | 39 |
| 40 void SatisfyCallback(cc::SurfaceManager* manager, | 40 void SatisfyCallback(cc::SurfaceManager* manager, |
| 41 const cc::SurfaceSequence& sequence) { | 41 const cc::SurfaceSequence& sequence) { |
| 42 std::vector<uint32_t> sequences; | 42 std::vector<uint32_t> sequences; |
| 43 sequences.push_back(sequence.sequence); | 43 sequences.push_back(sequence.sequence); |
| 44 manager->DidSatisfySequences(sequence.client_id, &sequences); | 44 manager->DidSatisfySequences(sequence.frame_sink_id, &sequences); |
| 45 } | 45 } |
| 46 | 46 |
| 47 void RequireCallback(cc::SurfaceManager* manager, | 47 void RequireCallback(cc::SurfaceManager* manager, |
| 48 const cc::SurfaceId& id, | 48 const cc::SurfaceId& id, |
| 49 const cc::SurfaceSequence& sequence) { | 49 const cc::SurfaceSequence& sequence) { |
| 50 cc::Surface* surface = manager->GetSurfaceForId(id); | 50 cc::Surface* surface = manager->GetSurfaceForId(id); |
| 51 if (!surface) { | 51 if (!surface) { |
| 52 LOG(ERROR) << "Attempting to require callback on nonexistent surface"; | 52 LOG(ERROR) << "Attempting to require callback on nonexistent surface"; |
| 53 return; | 53 return; |
| 54 } | 54 } |
| (...skipping 11 matching lines...) Expand all Loading... |
| 66 compositor_dependencies_(compositor_dependencies), | 66 compositor_dependencies_(compositor_dependencies), |
| 67 proxy_client_(nullptr), | 67 proxy_client_(nullptr), |
| 68 compositor_frame_sink_request_pending_(false), | 68 compositor_frame_sink_request_pending_(false), |
| 69 layer_(cc::Layer::Create()), | 69 layer_(cc::Layer::Create()), |
| 70 remote_proto_channel_receiver_(nullptr), | 70 remote_proto_channel_receiver_(nullptr), |
| 71 outstanding_commits_(0U), | 71 outstanding_commits_(0U), |
| 72 weak_ptr_factory_(this) { | 72 weak_ptr_factory_(this) { |
| 73 DCHECK(thread_checker_.CalledOnValidThread()); | 73 DCHECK(thread_checker_.CalledOnValidThread()); |
| 74 | 74 |
| 75 surface_id_allocator_ = base::MakeUnique<cc::SurfaceIdAllocator>( | 75 surface_id_allocator_ = base::MakeUnique<cc::SurfaceIdAllocator>( |
| 76 GetEmbedderDeps()->AllocateSurfaceClientId()); | 76 GetEmbedderDeps()->AllocateFrameSinkId()); |
| 77 GetEmbedderDeps()->GetSurfaceManager()->RegisterSurfaceClientId( | 77 GetEmbedderDeps()->GetSurfaceManager()->RegisterFrameSinkId( |
| 78 surface_id_allocator_->client_id()); | 78 surface_id_allocator_->frame_sink_id()); |
| 79 CreateLayerTreeHost(); | 79 CreateLayerTreeHost(); |
| 80 } | 80 } |
| 81 | 81 |
| 82 BlimpCompositor::~BlimpCompositor() { | 82 BlimpCompositor::~BlimpCompositor() { |
| 83 DCHECK(thread_checker_.CalledOnValidThread()); | 83 DCHECK(thread_checker_.CalledOnValidThread()); |
| 84 | 84 |
| 85 DestroyLayerTreeHost(); | 85 DestroyLayerTreeHost(); |
| 86 GetEmbedderDeps()->GetSurfaceManager()->InvalidateSurfaceClientId( | 86 GetEmbedderDeps()->GetSurfaceManager()->InvalidateFrameSinkId( |
| 87 surface_id_allocator_->client_id()); | 87 surface_id_allocator_->frame_sink_id()); |
| 88 | 88 |
| 89 CheckPendingCommitCounts(true /* flush */); | 89 CheckPendingCommitCounts(true /* flush */); |
| 90 } | 90 } |
| 91 | 91 |
| 92 void BlimpCompositor::SetVisible(bool visible) { | 92 void BlimpCompositor::SetVisible(bool visible) { |
| 93 host_->SetVisible(visible); | 93 host_->SetVisible(visible); |
| 94 | 94 |
| 95 if (!visible) | 95 if (!visible) |
| 96 CheckPendingCommitCounts(true /* flush */); | 96 CheckPendingCommitCounts(true /* flush */); |
| 97 } | 97 } |
| (...skipping 251 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 349 it->second.Run(); | 349 it->second.Run(); |
| 350 it = pending_commit_trackers_.erase(it); | 350 it = pending_commit_trackers_.erase(it); |
| 351 } else { | 351 } else { |
| 352 ++it; | 352 ++it; |
| 353 } | 353 } |
| 354 } | 354 } |
| 355 } | 355 } |
| 356 | 356 |
| 357 } // namespace client | 357 } // namespace client |
| 358 } // namespace blimp | 358 } // namespace blimp |
| OLD | NEW |