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

Side by Side Diff: cc/layers/layer.cc

Issue 1437413002: cc: Remove ScopedPtrVector and cc::remove_if. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: update 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 2010 The Chromium Authors. All rights reserved. 1 // Copyright 2010 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 "cc/layers/layer.h" 5 #include "cc/layers/layer.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 8
9 #include "base/atomic_sequence_num.h" 9 #include "base/atomic_sequence_num.h"
10 #include "base/location.h" 10 #include "base/location.h"
(...skipping 395 matching lines...) Expand 10 before | Expand all | Expand 10 after
406 return true; 406 return true;
407 } 407 }
408 return false; 408 return false;
409 } 409 }
410 410
411 void Layer::RequestCopyOfOutput( 411 void Layer::RequestCopyOfOutput(
412 scoped_ptr<CopyOutputRequest> request) { 412 scoped_ptr<CopyOutputRequest> request) {
413 DCHECK(IsPropertyChangeAllowed()); 413 DCHECK(IsPropertyChangeAllowed());
414 bool had_no_copy_requests = copy_requests_.empty(); 414 bool had_no_copy_requests = copy_requests_.empty();
415 if (void* source = request->source()) { 415 if (void* source = request->source()) {
416 auto it = std::find_if( 416 auto it = std::find_if(copy_requests_.begin(), copy_requests_.end(),
417 copy_requests_.begin(), copy_requests_.end(), 417 [source](const scoped_ptr<CopyOutputRequest>& x) {
418 [source](const CopyOutputRequest* x) { return x->source() == source; }); 418 return x->source() == source;
419 });
419 if (it != copy_requests_.end()) 420 if (it != copy_requests_.end())
420 copy_requests_.erase(it); 421 copy_requests_.erase(it);
421 } 422 }
422 if (request->IsEmpty()) 423 if (request->IsEmpty())
423 return; 424 return;
424 copy_requests_.push_back(request.Pass()); 425 copy_requests_.push_back(request.Pass());
425 if (had_no_copy_requests) { 426 if (had_no_copy_requests) {
426 UpdateNumCopyRequestsForSubtree(1); 427 UpdateNumCopyRequestsForSubtree(1);
427 } 428 }
428 SetNeedsCommit(); 429 SetNeedsCommit();
(...skipping 860 matching lines...) Expand 10 before | Expand all | Expand 10 after
1289 // active tree. To do so, avoid scrolling the pending tree along with it 1290 // active tree. To do so, avoid scrolling the pending tree along with it
1290 // instead of trying to undo that scrolling later. 1291 // instead of trying to undo that scrolling later.
1291 if (ScrollOffsetAnimationWasInterrupted()) 1292 if (ScrollOffsetAnimationWasInterrupted())
1292 layer->PushScrollOffsetFromMainThreadAndClobberActiveValue(scroll_offset_); 1293 layer->PushScrollOffsetFromMainThreadAndClobberActiveValue(scroll_offset_);
1293 else 1294 else
1294 layer->PushScrollOffsetFromMainThread(scroll_offset_); 1295 layer->PushScrollOffsetFromMainThread(scroll_offset_);
1295 layer->SetScrollCompensationAdjustment(ScrollCompensationAdjustment()); 1296 layer->SetScrollCompensationAdjustment(ScrollCompensationAdjustment());
1296 1297
1297 // Wrap the copy_requests_ in a PostTask to the main thread. 1298 // Wrap the copy_requests_ in a PostTask to the main thread.
1298 bool had_copy_requests = !copy_requests_.empty(); 1299 bool had_copy_requests = !copy_requests_.empty();
1299 ScopedPtrVector<CopyOutputRequest> main_thread_copy_requests; 1300 std::vector<scoped_ptr<CopyOutputRequest>> main_thread_copy_requests;
1300 for (ScopedPtrVector<CopyOutputRequest>::iterator it = copy_requests_.begin(); 1301 for (std::vector<scoped_ptr<CopyOutputRequest>>::iterator it =
danakj 2015/11/17 23:49:41 auto
vmpstr 2015/11/18 00:08:46 Done.
1301 it != copy_requests_.end(); 1302 copy_requests_.begin();
1302 ++it) { 1303 it != copy_requests_.end(); ++it) {
1303 scoped_refptr<base::SingleThreadTaskRunner> main_thread_task_runner = 1304 scoped_refptr<base::SingleThreadTaskRunner> main_thread_task_runner =
1304 layer_tree_host()->task_runner_provider()->MainThreadTaskRunner(); 1305 layer_tree_host()->task_runner_provider()->MainThreadTaskRunner();
1305 scoped_ptr<CopyOutputRequest> original_request = copy_requests_.take(it); 1306 scoped_ptr<CopyOutputRequest> original_request = std::move(*it);
1306 const CopyOutputRequest& original_request_ref = *original_request; 1307 const CopyOutputRequest& original_request_ref = *original_request;
1307 scoped_ptr<CopyOutputRequest> main_thread_request = 1308 scoped_ptr<CopyOutputRequest> main_thread_request =
1308 CopyOutputRequest::CreateRelayRequest( 1309 CopyOutputRequest::CreateRelayRequest(
1309 original_request_ref, 1310 original_request_ref,
1310 base::Bind(&PostCopyCallbackToMainThread, 1311 base::Bind(&PostCopyCallbackToMainThread,
1311 main_thread_task_runner, 1312 main_thread_task_runner,
1312 base::Passed(&original_request))); 1313 base::Passed(&original_request)));
1313 main_thread_copy_requests.push_back(main_thread_request.Pass()); 1314 main_thread_copy_requests.push_back(main_thread_request.Pass());
1314 } 1315 }
1315 if (!copy_requests_.empty() && layer_tree_host_) 1316 if (!copy_requests_.empty() && layer_tree_host_)
(...skipping 460 matching lines...) Expand 10 before | Expand all | Expand 10 after
1776 this, layer_tree_host_->property_trees()->transform_tree); 1777 this, layer_tree_host_->property_trees()->transform_tree);
1777 } 1778 }
1778 1779
1779 gfx::Transform Layer::screen_space_transform() const { 1780 gfx::Transform Layer::screen_space_transform() const {
1780 DCHECK_NE(transform_tree_index_, -1); 1781 DCHECK_NE(transform_tree_index_, -1);
1781 return ScreenSpaceTransformFromPropertyTrees( 1782 return ScreenSpaceTransformFromPropertyTrees(
1782 this, layer_tree_host_->property_trees()->transform_tree); 1783 this, layer_tree_host_->property_trees()->transform_tree);
1783 } 1784 }
1784 1785
1785 } // namespace cc 1786 } // namespace cc
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698