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

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

Issue 17114008: cc: Remove cc::Thread and cc::ThreadImpl. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: rm-thread: NULLrefptrs Created 7 years, 6 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 | Annotate | Revision Log
« no previous file with comments | « cc/layers/delegated_renderer_layer_impl_unittest.cc ('k') | cc/layers/layer_unittest.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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/location.h"
9 #include "base/metrics/histogram.h" 10 #include "base/metrics/histogram.h"
11 #include "base/single_thread_task_runner.h"
10 #include "cc/animation/animation.h" 12 #include "cc/animation/animation.h"
11 #include "cc/animation/animation_events.h" 13 #include "cc/animation/animation_events.h"
12 #include "cc/animation/layer_animation_controller.h" 14 #include "cc/animation/layer_animation_controller.h"
13 #include "cc/base/thread.h"
14 #include "cc/layers/layer_impl.h" 15 #include "cc/layers/layer_impl.h"
15 #include "cc/output/copy_output_request.h" 16 #include "cc/output/copy_output_request.h"
16 #include "cc/output/copy_output_result.h" 17 #include "cc/output/copy_output_result.h"
17 #include "cc/trees/layer_tree_host.h" 18 #include "cc/trees/layer_tree_host.h"
18 #include "cc/trees/layer_tree_impl.h" 19 #include "cc/trees/layer_tree_impl.h"
19 #include "third_party/WebKit/public/platform/WebAnimationDelegate.h" 20 #include "third_party/WebKit/public/platform/WebAnimationDelegate.h"
20 #include "third_party/WebKit/public/platform/WebLayerScrollClient.h" 21 #include "third_party/WebKit/public/platform/WebLayerScrollClient.h"
21 #include "third_party/skia/include/core/SkImageFilter.h" 22 #include "third_party/skia/include/core/SkImageFilter.h"
22 #include "ui/gfx/rect_conversions.h" 23 #include "ui/gfx/rect_conversions.h"
23 24
(...skipping 626 matching lines...) Expand 10 before | Expand all | Expand 10 after
650 return; 651 return;
651 position_constraint_ = constraint; 652 position_constraint_ = constraint;
652 SetNeedsCommit(); 653 SetNeedsCommit();
653 } 654 }
654 655
655 static void RunCopyCallbackOnMainThread(scoped_ptr<CopyOutputRequest> request, 656 static void RunCopyCallbackOnMainThread(scoped_ptr<CopyOutputRequest> request,
656 scoped_ptr<CopyOutputResult> result) { 657 scoped_ptr<CopyOutputResult> result) {
657 request->SendResult(result.Pass()); 658 request->SendResult(result.Pass());
658 } 659 }
659 660
660 static void PostCopyCallbackToMainThread(Thread* main_thread, 661 static void PostCopyCallbackToMainThread(
661 scoped_ptr<CopyOutputRequest> request, 662 scoped_refptr<base::SingleThreadTaskRunner> main_thread_task_runner,
662 scoped_ptr<CopyOutputResult> result) { 663 scoped_ptr<CopyOutputRequest> request,
663 main_thread->PostTask(base::Bind(&RunCopyCallbackOnMainThread, 664 scoped_ptr<CopyOutputResult> result) {
664 base::Passed(&request), 665 main_thread_task_runner->PostTask(FROM_HERE,
665 base::Passed(&result))); 666 base::Bind(&RunCopyCallbackOnMainThread,
667 base::Passed(&request),
668 base::Passed(&result)));
666 } 669 }
667 670
668 void Layer::PushPropertiesTo(LayerImpl* layer) { 671 void Layer::PushPropertiesTo(LayerImpl* layer) {
669 layer->SetAnchorPoint(anchor_point_); 672 layer->SetAnchorPoint(anchor_point_);
670 layer->SetAnchorPointZ(anchor_point_z_); 673 layer->SetAnchorPointZ(anchor_point_z_);
671 layer->SetBackgroundColor(background_color_); 674 layer->SetBackgroundColor(background_color_);
672 layer->SetBounds(paint_properties_.bounds); 675 layer->SetBounds(paint_properties_.bounds);
673 layer->SetContentBounds(content_bounds()); 676 layer->SetContentBounds(content_bounds());
674 layer->SetContentsScale(contents_scale_x(), contents_scale_y()); 677 layer->SetContentsScale(contents_scale_x(), contents_scale_y());
675 layer->SetDebugName(debug_name_); 678 layer->SetDebugName(debug_name_);
(...skipping 29 matching lines...) Expand all
705 708
706 layer->SetScrollable(scrollable_); 709 layer->SetScrollable(scrollable_);
707 layer->SetScrollOffset(scroll_offset_); 710 layer->SetScrollOffset(scroll_offset_);
708 layer->SetMaxScrollOffset(max_scroll_offset_); 711 layer->SetMaxScrollOffset(max_scroll_offset_);
709 712
710 // Wrap the copy_requests_ in a PostTask to the main thread. 713 // Wrap the copy_requests_ in a PostTask to the main thread.
711 ScopedPtrVector<CopyOutputRequest> main_thread_copy_requests; 714 ScopedPtrVector<CopyOutputRequest> main_thread_copy_requests;
712 for (ScopedPtrVector<CopyOutputRequest>::iterator it = copy_requests_.begin(); 715 for (ScopedPtrVector<CopyOutputRequest>::iterator it = copy_requests_.begin();
713 it != copy_requests_.end(); 716 it != copy_requests_.end();
714 ++it) { 717 ++it) {
718 scoped_refptr<base::SingleThreadTaskRunner> main_thread_task_runner =
719 layer_tree_host()->proxy()->MainThreadTaskRunner();
715 scoped_ptr<CopyOutputRequest> original_request = copy_requests_.take(it); 720 scoped_ptr<CopyOutputRequest> original_request = copy_requests_.take(it);
716 const CopyOutputRequest& original_request_ref = *original_request; 721 const CopyOutputRequest& original_request_ref = *original_request;
717 scoped_ptr<CopyOutputRequest> main_thread_request = 722 scoped_ptr<CopyOutputRequest> main_thread_request =
718 CopyOutputRequest::CreateRelayRequest( 723 CopyOutputRequest::CreateRelayRequest(
719 original_request_ref, 724 original_request_ref,
720 base::Bind(&PostCopyCallbackToMainThread, 725 base::Bind(&PostCopyCallbackToMainThread,
721 layer_tree_host()->proxy()->MainThread(), 726 main_thread_task_runner,
722 base::Passed(&original_request))); 727 base::Passed(&original_request)));
723 main_thread_copy_requests.push_back(main_thread_request.Pass()); 728 main_thread_copy_requests.push_back(main_thread_request.Pass());
724 } 729 }
725 copy_requests_.clear(); 730 copy_requests_.clear();
726 layer->PassCopyRequests(&main_thread_copy_requests); 731 layer->PassCopyRequests(&main_thread_copy_requests);
727 732
728 // If the main thread commits multiple times before the impl thread actually 733 // If the main thread commits multiple times before the impl thread actually
729 // draws, then damage tracking will become incorrect if we simply clobber the 734 // draws, then damage tracking will become incorrect if we simply clobber the
730 // update_rect here. The LayerImpl's update_rect needs to accumulate (i.e. 735 // update_rect here. The LayerImpl's update_rect needs to accumulate (i.e.
731 // union) any update changes that have occurred on the main thread. 736 // union) any update changes that have occurred on the main thread.
(...skipping 150 matching lines...) Expand 10 before | Expand all | Expand 10 after
882 887
883 RenderingStatsInstrumentation* Layer::rendering_stats_instrumentation() const { 888 RenderingStatsInstrumentation* Layer::rendering_stats_instrumentation() const {
884 return layer_tree_host_->rendering_stats_instrumentation(); 889 return layer_tree_host_->rendering_stats_instrumentation();
885 } 890 }
886 891
887 bool Layer::SupportsLCDText() const { 892 bool Layer::SupportsLCDText() const {
888 return false; 893 return false;
889 } 894 }
890 895
891 } // namespace cc 896 } // namespace cc
OLDNEW
« no previous file with comments | « cc/layers/delegated_renderer_layer_impl_unittest.cc ('k') | cc/layers/layer_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698