| OLD | NEW | 
|    1 // Copyright 2011 The Chromium Authors. All rights reserved. |    1 // Copyright 2011 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/trees/single_thread_proxy.h" |    5 #include "cc/trees/single_thread_proxy.h" | 
|    6  |    6  | 
|    7 #include "base/auto_reset.h" |    7 #include "base/auto_reset.h" | 
|    8 #include "base/debug/trace_event.h" |    8 #include "base/debug/trace_event.h" | 
|    9 #include "cc/debug/benchmark_instrumentation.h" |    9 #include "cc/debug/benchmark_instrumentation.h" | 
|   10 #include "cc/output/context_provider.h" |   10 #include "cc/output/context_provider.h" | 
|   11 #include "cc/output/output_surface.h" |   11 #include "cc/output/output_surface.h" | 
|   12 #include "cc/quads/draw_quad.h" |   12 #include "cc/quads/draw_quad.h" | 
|   13 #include "cc/resources/prioritized_resource_manager.h" |   13 #include "cc/resources/prioritized_resource_manager.h" | 
|   14 #include "cc/resources/resource_update_controller.h" |   14 #include "cc/resources/resource_update_controller.h" | 
|   15 #include "cc/trees/blocking_task_runner.h" |   15 #include "cc/trees/blocking_task_runner.h" | 
|   16 #include "cc/trees/layer_tree_host.h" |   16 #include "cc/trees/layer_tree_host.h" | 
|   17 #include "cc/trees/layer_tree_impl.h" |   17 #include "cc/trees/layer_tree_impl.h" | 
 |   18 #include "ui/gfx/frame_time.h" | 
|   18  |   19  | 
|   19 namespace cc { |   20 namespace cc { | 
|   20  |   21  | 
|   21 scoped_ptr<Proxy> SingleThreadProxy::Create(LayerTreeHost* layer_tree_host) { |   22 scoped_ptr<Proxy> SingleThreadProxy::Create(LayerTreeHost* layer_tree_host) { | 
|   22   return make_scoped_ptr( |   23   return make_scoped_ptr( | 
|   23       new SingleThreadProxy(layer_tree_host)).PassAs<Proxy>(); |   24       new SingleThreadProxy(layer_tree_host)).PassAs<Proxy>(); | 
|   24 } |   25 } | 
|   25  |   26  | 
|   26 SingleThreadProxy::SingleThreadProxy(LayerTreeHost* layer_tree_host) |   27 SingleThreadProxy::SingleThreadProxy(LayerTreeHost* layer_tree_host) | 
|   27     : Proxy(NULL), |   28     : Proxy(NULL), | 
| (...skipping 24 matching lines...) Expand all  Loading... | 
|   52   DCHECK(!layer_tree_host_impl_); |   53   DCHECK(!layer_tree_host_impl_); | 
|   53 } |   54 } | 
|   54  |   55  | 
|   55 bool SingleThreadProxy::CompositeAndReadback(void* pixels, gfx::Rect rect) { |   56 bool SingleThreadProxy::CompositeAndReadback(void* pixels, gfx::Rect rect) { | 
|   56   TRACE_EVENT0("cc", "SingleThreadProxy::CompositeAndReadback"); |   57   TRACE_EVENT0("cc", "SingleThreadProxy::CompositeAndReadback"); | 
|   57   DCHECK(Proxy::IsMainThread()); |   58   DCHECK(Proxy::IsMainThread()); | 
|   58  |   59  | 
|   59   gfx::Rect device_viewport_damage_rect = rect; |   60   gfx::Rect device_viewport_damage_rect = rect; | 
|   60  |   61  | 
|   61   LayerTreeHostImpl::FrameData frame; |   62   LayerTreeHostImpl::FrameData frame; | 
|   62   if (!CommitAndComposite(base::TimeTicks::Now(), |   63   if (!CommitAndComposite(gfx::FrameTime::Now(), | 
|   63                           device_viewport_damage_rect, |   64                           device_viewport_damage_rect, | 
|   64                           true,  // for_readback |   65                           true,  // for_readback | 
|   65                           &frame)) |   66                           &frame)) | 
|   66     return false; |   67     return false; | 
|   67  |   68  | 
|   68   { |   69   { | 
|   69     DebugScopedSetImplThread impl(this); |   70     DebugScopedSetImplThread impl(this); | 
|   70     layer_tree_host_impl_->Readback(pixels, rect); |   71     layer_tree_host_impl_->Readback(pixels, rect); | 
|   71  |   72  | 
|   72     if (layer_tree_host_impl_->IsContextLost()) |   73     if (layer_tree_host_impl_->IsContextLost()) | 
| (...skipping 456 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
|  529 void SingleThreadProxy::DidSwapFrame() { |  530 void SingleThreadProxy::DidSwapFrame() { | 
|  530   if (next_frame_is_newly_committed_frame_) { |  531   if (next_frame_is_newly_committed_frame_) { | 
|  531     next_frame_is_newly_committed_frame_ = false; |  532     next_frame_is_newly_committed_frame_ = false; | 
|  532     layer_tree_host_->DidCommitAndDrawFrame(); |  533     layer_tree_host_->DidCommitAndDrawFrame(); | 
|  533   } |  534   } | 
|  534 } |  535 } | 
|  535  |  536  | 
|  536 bool SingleThreadProxy::CommitPendingForTesting() { return false; } |  537 bool SingleThreadProxy::CommitPendingForTesting() { return false; } | 
|  537  |  538  | 
|  538 }  // namespace cc |  539 }  // namespace cc | 
| OLD | NEW |