Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(299)

Side by Side Diff: content/browser/renderer_host/delegated_frame_host.cc

Issue 2102123002: Make Satisfy/Require callbacks pass Surface id and sequence by reference (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebase Created 4 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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
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 481 matching lines...) Expand 10 before | Expand all | Expand 10 after
544 void DelegatedFrameHost::ReturnResources( 544 void DelegatedFrameHost::ReturnResources(
545 const cc::ReturnedResourceArray& resources) { 545 const cc::ReturnedResourceArray& resources) {
546 if (resources.empty()) 546 if (resources.empty())
547 return; 547 return;
548 std::copy(resources.begin(), resources.end(), 548 std::copy(resources.begin(), resources.end(),
549 std::back_inserter(surface_returned_resources_)); 549 std::back_inserter(surface_returned_resources_));
550 if (!pending_delegated_ack_count_) 550 if (!pending_delegated_ack_count_)
551 SendReturnedDelegatedResources(last_output_surface_id_); 551 SendReturnedDelegatedResources(last_output_surface_id_);
552 } 552 }
553 553
554 void DelegatedFrameHost::WillDrawSurface(cc::SurfaceId id, 554 void DelegatedFrameHost::WillDrawSurface(const cc::SurfaceId& id,
555 const gfx::Rect& damage_rect) { 555 const gfx::Rect& damage_rect) {
556 // Frame subscribers are only interested in changes to the target surface, so 556 // Frame subscribers are only interested in changes to the target surface, so
557 // do not attempt capture if |damage_rect| is empty. This prevents the draws 557 // do not attempt capture if |damage_rect| is empty. This prevents the draws
558 // of parent surfaces from triggering extra frame captures, which can affect 558 // of parent surfaces from triggering extra frame captures, which can affect
559 // smoothness. 559 // smoothness.
560 if (id != surface_id_ || damage_rect.IsEmpty()) 560 if (id != surface_id_ || damage_rect.IsEmpty())
561 return; 561 return;
562 AttemptFrameSubscriberCapture(damage_rect); 562 AttemptFrameSubscriberCapture(damage_rect);
563 } 563 }
564 564
(...skipping 330 matching lines...) Expand 10 before | Expand all | Expand 10 after
895 cc::SurfaceManager* manager = factory->GetSurfaceManager(); 895 cc::SurfaceManager* manager = factory->GetSurfaceManager();
896 new_layer->SetShowSurface( 896 new_layer->SetShowSurface(
897 surface_id_, base::Bind(&SatisfyCallback, base::Unretained(manager)), 897 surface_id_, base::Bind(&SatisfyCallback, base::Unretained(manager)),
898 base::Bind(&RequireCallback, base::Unretained(manager)), 898 base::Bind(&RequireCallback, base::Unretained(manager)),
899 current_surface_size_, current_scale_factor_, 899 current_surface_size_, current_scale_factor_,
900 current_frame_size_in_dip_); 900 current_frame_size_in_dip_);
901 } 901 }
902 } 902 }
903 903
904 } // namespace content 904 } // namespace content
OLDNEW
« no previous file with comments | « content/browser/renderer_host/delegated_frame_host.h ('k') | content/browser/renderer_host/offscreen_canvas_surface_impl.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698