| 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 23 matching lines...) Expand all Loading... |
| 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(cc::SurfaceManager* manager, |
| 44 cc::SurfaceSequence sequence) { | 44 const cc::SurfaceSequence& sequence) { |
| 45 std::vector<uint32_t> sequences; | 45 std::vector<uint32_t> sequences; |
| 46 sequences.push_back(sequence.sequence); | 46 sequences.push_back(sequence.sequence); |
| 47 manager->DidSatisfySequences(sequence.id_namespace, &sequences); | 47 manager->DidSatisfySequences(sequence.id_namespace, &sequences); |
| 48 } | 48 } |
| 49 | 49 |
| 50 void RequireCallback(cc::SurfaceManager* manager, | 50 void RequireCallback(cc::SurfaceManager* manager, |
| 51 cc::SurfaceId id, | 51 const cc::SurfaceId& id, |
| 52 cc::SurfaceSequence sequence) { | 52 const cc::SurfaceSequence& sequence) { |
| 53 cc::Surface* surface = manager->GetSurfaceForId(id); | 53 cc::Surface* surface = manager->GetSurfaceForId(id); |
| 54 if (!surface) { | 54 if (!surface) { |
| 55 LOG(ERROR) << "Attempting to require callback on nonexistent surface"; | 55 LOG(ERROR) << "Attempting to require callback on nonexistent surface"; |
| 56 return; | 56 return; |
| 57 } | 57 } |
| 58 surface->AddDestructionDependency(sequence); | 58 surface->AddDestructionDependency(sequence); |
| 59 } | 59 } |
| 60 | 60 |
| 61 } // namespace | 61 } // namespace |
| 62 | 62 |
| (...skipping 483 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 546 void DelegatedFrameHost::ReturnResources( | 546 void DelegatedFrameHost::ReturnResources( |
| 547 const cc::ReturnedResourceArray& resources) { | 547 const cc::ReturnedResourceArray& resources) { |
| 548 if (resources.empty()) | 548 if (resources.empty()) |
| 549 return; | 549 return; |
| 550 std::copy(resources.begin(), resources.end(), | 550 std::copy(resources.begin(), resources.end(), |
| 551 std::back_inserter(surface_returned_resources_)); | 551 std::back_inserter(surface_returned_resources_)); |
| 552 if (!pending_delegated_ack_count_) | 552 if (!pending_delegated_ack_count_) |
| 553 SendReturnedDelegatedResources(last_output_surface_id_); | 553 SendReturnedDelegatedResources(last_output_surface_id_); |
| 554 } | 554 } |
| 555 | 555 |
| 556 void DelegatedFrameHost::WillDrawSurface(cc::SurfaceId id, | 556 void DelegatedFrameHost::WillDrawSurface(const cc::SurfaceId& id, |
| 557 const gfx::Rect& damage_rect) { | 557 const gfx::Rect& damage_rect) { |
| 558 // Frame subscribers are only interested in changes to the target surface, so | 558 // Frame subscribers are only interested in changes to the target surface, so |
| 559 // do not attempt capture if |damage_rect| is empty. This prevents the draws | 559 // do not attempt capture if |damage_rect| is empty. This prevents the draws |
| 560 // of parent surfaces from triggering extra frame captures, which can affect | 560 // of parent surfaces from triggering extra frame captures, which can affect |
| 561 // smoothness. | 561 // smoothness. |
| 562 if (id != surface_id_ || damage_rect.IsEmpty()) | 562 if (id != surface_id_ || damage_rect.IsEmpty()) |
| 563 return; | 563 return; |
| 564 AttemptFrameSubscriberCapture(damage_rect); | 564 AttemptFrameSubscriberCapture(damage_rect); |
| 565 } | 565 } |
| 566 | 566 |
| (...skipping 330 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 897 cc::SurfaceManager* manager = factory->GetSurfaceManager(); | 897 cc::SurfaceManager* manager = factory->GetSurfaceManager(); |
| 898 new_layer->SetShowSurface( | 898 new_layer->SetShowSurface( |
| 899 surface_id_, base::Bind(&SatisfyCallback, base::Unretained(manager)), | 899 surface_id_, base::Bind(&SatisfyCallback, base::Unretained(manager)), |
| 900 base::Bind(&RequireCallback, base::Unretained(manager)), | 900 base::Bind(&RequireCallback, base::Unretained(manager)), |
| 901 current_surface_size_, current_scale_factor_, | 901 current_surface_size_, current_scale_factor_, |
| 902 current_frame_size_in_dip_); | 902 current_frame_size_in_dip_); |
| 903 } | 903 } |
| 904 } | 904 } |
| 905 | 905 |
| 906 } // namespace content | 906 } // namespace content |
| OLD | NEW |