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/renderer_host/delegated_frame_host.h" | 5 #include "content/browser/renderer_host/delegated_frame_host.h" |
| 6 | 6 |
| 7 #include <algorithm> | 7 #include <algorithm> |
| 8 #include <string> | 8 #include <string> |
| 9 #include <utility> | 9 #include <utility> |
| 10 #include <vector> | 10 #include <vector> |
| (...skipping 22 matching lines...) Expand all Loading... | |
| 33 #include "skia/ext/image_operations.h" | 33 #include "skia/ext/image_operations.h" |
| 34 #include "third_party/skia/include/core/SkCanvas.h" | 34 #include "third_party/skia/include/core/SkCanvas.h" |
| 35 #include "third_party/skia/include/core/SkPaint.h" | 35 #include "third_party/skia/include/core/SkPaint.h" |
| 36 #include "third_party/skia/include/effects/SkLumaColorFilter.h" | 36 #include "third_party/skia/include/effects/SkLumaColorFilter.h" |
| 37 #include "ui/gfx/geometry/dip_util.h" | 37 #include "ui/gfx/geometry/dip_util.h" |
| 38 | 38 |
| 39 namespace content { | 39 namespace content { |
| 40 | 40 |
| 41 namespace { | 41 namespace { |
| 42 | 42 |
| 43 void SatisfyCallback(cc::SurfaceManager* manager, | 43 void SatisfyCallback(base::WeakPtr<cc::SurfaceManager> manager, |
| 44 const cc::SurfaceSequence& sequence) { | 44 const cc::SurfaceSequence& sequence) { |
| 45 if (!manager) | |
| 46 return; | |
| 45 std::vector<uint32_t> sequences; | 47 std::vector<uint32_t> sequences; |
| 46 sequences.push_back(sequence.sequence); | 48 sequences.push_back(sequence.sequence); |
| 47 manager->DidSatisfySequences(sequence.frame_sink_id, &sequences); | 49 manager->DidSatisfySequences(sequence.frame_sink_id, &sequences); |
| 48 } | 50 } |
| 49 | 51 |
| 50 void RequireCallback(cc::SurfaceManager* manager, | 52 void RequireCallback(base::WeakPtr<cc::SurfaceManager> manager, |
| 51 const cc::SurfaceId& id, | 53 const cc::SurfaceId& id, |
| 52 const cc::SurfaceSequence& sequence) { | 54 const cc::SurfaceSequence& sequence) { |
| 55 DCHECK(manager); | |
|
jam
2016/12/16 01:02:17
nit: remove this, it's not necessary. in release b
| |
| 53 cc::Surface* surface = manager->GetSurfaceForId(id); | 56 cc::Surface* surface = manager->GetSurfaceForId(id); |
| 54 if (!surface) { | 57 if (!surface) { |
| 55 LOG(ERROR) << "Attempting to require callback on nonexistent surface"; | 58 LOG(ERROR) << "Attempting to require callback on nonexistent surface"; |
| 56 return; | 59 return; |
| 57 } | 60 } |
| 58 surface->AddDestructionDependency(sequence); | 61 surface->AddDestructionDependency(sequence); |
| 59 } | 62 } |
| 60 | 63 |
| 61 } // namespace | 64 } // namespace |
| 62 | 65 |
| (...skipping 443 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 506 ack_callback = base::Bind(&DelegatedFrameHost::SurfaceDrawn, AsWeakPtr(), | 509 ack_callback = base::Bind(&DelegatedFrameHost::SurfaceDrawn, AsWeakPtr(), |
| 507 compositor_frame_sink_id); | 510 compositor_frame_sink_id); |
| 508 did_send_ack_callback = true; | 511 did_send_ack_callback = true; |
| 509 } | 512 } |
| 510 surface_factory_->SubmitCompositorFrame(local_frame_id_, std::move(frame), | 513 surface_factory_->SubmitCompositorFrame(local_frame_id_, std::move(frame), |
| 511 ack_callback); | 514 ack_callback); |
| 512 if (allocated_new_local_frame_id) { | 515 if (allocated_new_local_frame_id) { |
| 513 // manager must outlive compositors using it. | 516 // manager must outlive compositors using it. |
| 514 client_->DelegatedFrameHostGetLayer()->SetShowSurface( | 517 client_->DelegatedFrameHostGetLayer()->SetShowSurface( |
| 515 cc::SurfaceId(frame_sink_id_, local_frame_id_), | 518 cc::SurfaceId(frame_sink_id_, local_frame_id_), |
| 516 base::Bind(&SatisfyCallback, base::Unretained(manager)), | 519 base::Bind(&SatisfyCallback, manager->GetWeakPtr()), |
| 517 base::Bind(&RequireCallback, base::Unretained(manager)), frame_size, | 520 base::Bind(&RequireCallback, manager->GetWeakPtr()), frame_size, |
| 518 frame_device_scale_factor); | 521 frame_device_scale_factor); |
| 519 current_surface_size_ = frame_size; | 522 current_surface_size_ = frame_size; |
| 520 current_scale_factor_ = frame_device_scale_factor; | 523 current_scale_factor_ = frame_device_scale_factor; |
| 521 } | 524 } |
| 522 } | 525 } |
| 523 released_front_lock_ = NULL; | 526 released_front_lock_ = NULL; |
| 524 current_frame_size_in_dip_ = frame_size_in_dip; | 527 current_frame_size_in_dip_ = frame_size_in_dip; |
| 525 CheckResizeLock(); | 528 CheckResizeLock(); |
| 526 | 529 |
| 527 UpdateGutters(); | 530 UpdateGutters(); |
| (...skipping 361 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 889 std::move(request)); | 892 std::move(request)); |
| 890 } | 893 } |
| 891 } | 894 } |
| 892 | 895 |
| 893 void DelegatedFrameHost::UnlockResources() { | 896 void DelegatedFrameHost::UnlockResources() { |
| 894 DCHECK(local_frame_id_.is_valid()); | 897 DCHECK(local_frame_id_.is_valid()); |
| 895 delegated_frame_evictor_->UnlockFrame(); | 898 delegated_frame_evictor_->UnlockFrame(); |
| 896 } | 899 } |
| 897 | 900 |
| 898 } // namespace content | 901 } // namespace content |
| OLD | NEW |