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

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

Issue 1437413002: cc: Remove ScopedPtrVector and cc::remove_if. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: just the vector Created 5 years, 1 month 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/compositor/delegated_frame_host.h" 5 #include "content/browser/compositor/delegated_frame_host.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 #include <string> 8 #include <string>
9 #include <vector> 9 #include <vector>
10 10
(...skipping 301 matching lines...) Expand 10 before | Expand all | Expand 10 after
312 } 312 }
313 313
314 void DelegatedFrameHost::SwapDelegatedFrame( 314 void DelegatedFrameHost::SwapDelegatedFrame(
315 uint32 output_surface_id, 315 uint32 output_surface_id,
316 scoped_ptr<cc::DelegatedFrameData> frame_data, 316 scoped_ptr<cc::DelegatedFrameData> frame_data,
317 float frame_device_scale_factor, 317 float frame_device_scale_factor,
318 const std::vector<ui::LatencyInfo>& latency_info, 318 const std::vector<ui::LatencyInfo>& latency_info,
319 std::vector<uint32_t>* satisfies_sequences) { 319 std::vector<uint32_t>* satisfies_sequences) {
320 DCHECK(!frame_data->render_pass_list.empty()); 320 DCHECK(!frame_data->render_pass_list.empty());
321 321
322 cc::RenderPass* root_pass = frame_data->render_pass_list.back(); 322 cc::RenderPass* root_pass = frame_data->render_pass_list.back().get();
323 323
324 gfx::Size frame_size = root_pass->output_rect.size(); 324 gfx::Size frame_size = root_pass->output_rect.size();
325 gfx::Size frame_size_in_dip = 325 gfx::Size frame_size_in_dip =
326 gfx::ConvertSizeToDIP(frame_device_scale_factor, frame_size); 326 gfx::ConvertSizeToDIP(frame_device_scale_factor, frame_size);
327 327
328 gfx::Rect damage_rect = root_pass->damage_rect; 328 gfx::Rect damage_rect = root_pass->damage_rect;
329 damage_rect.Intersect(gfx::Rect(frame_size)); 329 damage_rect.Intersect(gfx::Rect(frame_size));
330 gfx::Rect damage_rect_in_dip = 330 gfx::Rect damage_rect_in_dip =
331 gfx::ConvertRectToDIP(frame_device_scale_factor, damage_rect); 331 gfx::ConvertRectToDIP(frame_device_scale_factor, damage_rect);
332 332
333 if (ShouldSkipFrame(frame_size_in_dip)) { 333 if (ShouldSkipFrame(frame_size_in_dip)) {
334 cc::CompositorFrameAck ack; 334 cc::CompositorFrameAck ack;
335 cc::TransferableResource::ReturnResources(frame_data->resource_list, 335 cc::TransferableResource::ReturnResources(frame_data->resource_list,
336 &ack.resources); 336 &ack.resources);
337 337
338 skipped_latency_info_list_.insert(skipped_latency_info_list_.end(), 338 skipped_latency_info_list_.insert(skipped_latency_info_list_.end(),
339 latency_info.begin(), latency_info.end()); 339 latency_info.begin(), latency_info.end());
340 340
341 client_->DelegatedFrameHostSendCompositorSwapAck(output_surface_id, ack); 341 client_->DelegatedFrameHostSendCompositorSwapAck(output_surface_id, ack);
342 skipped_frames_ = true; 342 skipped_frames_ = true;
343 return; 343 return;
344 } 344 }
345 345
346 if (skipped_frames_) { 346 if (skipped_frames_) {
347 skipped_frames_ = false; 347 skipped_frames_ = false;
348 damage_rect = gfx::Rect(frame_size); 348 damage_rect = gfx::Rect(frame_size);
349 damage_rect_in_dip = gfx::Rect(frame_size_in_dip); 349 damage_rect_in_dip = gfx::Rect(frame_size_in_dip);
350 350
351 // Give the same damage rect to the compositor. 351 // Give the same damage rect to the compositor.
352 cc::RenderPass* root_pass = frame_data->render_pass_list.back(); 352 cc::RenderPass* root_pass = frame_data->render_pass_list.back().get();
353 root_pass->damage_rect = damage_rect; 353 root_pass->damage_rect = damage_rect;
354 } 354 }
355 355
356 if (output_surface_id != last_output_surface_id_) { 356 if (output_surface_id != last_output_surface_id_) {
357 // Resource ids are scoped by the output surface. 357 // Resource ids are scoped by the output surface.
358 // If the originating output surface doesn't match the last one, it 358 // If the originating output surface doesn't match the last one, it
359 // indicates the renderer's output surface may have been recreated, in which 359 // indicates the renderer's output surface may have been recreated, in which
360 // case we should recreate the DelegatedRendererLayer, to avoid matching 360 // case we should recreate the DelegatedRendererLayer, to avoid matching
361 // resources from the old one with resources from the new one which would 361 // resources from the old one with resources from the new one which would
362 // have the same id. Changing the layer to showing painted content destroys 362 // have the same id. Changing the layer to showing painted content destroys
(...skipping 680 matching lines...) Expand 10 before | Expand all | Expand 10 after
1043 cc::SurfaceManager* manager = factory->GetSurfaceManager(); 1043 cc::SurfaceManager* manager = factory->GetSurfaceManager();
1044 new_layer->SetShowSurface( 1044 new_layer->SetShowSurface(
1045 surface_id_, base::Bind(&SatisfyCallback, base::Unretained(manager)), 1045 surface_id_, base::Bind(&SatisfyCallback, base::Unretained(manager)),
1046 base::Bind(&RequireCallback, base::Unretained(manager)), 1046 base::Bind(&RequireCallback, base::Unretained(manager)),
1047 current_surface_size_, current_scale_factor_, 1047 current_surface_size_, current_scale_factor_,
1048 current_frame_size_in_dip_); 1048 current_frame_size_in_dip_);
1049 } 1049 }
1050 } 1050 }
1051 1051
1052 } // namespace content 1052 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698