| OLD | NEW | 
|    1 // Copyright 2015 The Chromium Authors. All rights reserved. |    1 // Copyright 2015 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/android/synchronous_compositor_host.h" |    5 #include "content/browser/android/synchronous_compositor_host.h" | 
|    6  |    6  | 
|    7 #include <utility> |    7 #include <utility> | 
|    8  |    8  | 
|    9 #include "base/command_line.h" |    9 #include "base/command_line.h" | 
|   10 #include "base/containers/hash_tables.h" |   10 #include "base/containers/hash_tables.h" | 
| (...skipping 27 matching lines...) Expand all  Loading... | 
|   38   DCHECK(contents); |   38   DCHECK(contents); | 
|   39   DCHECK(client); |   39   DCHECK(client); | 
|   40   WebContentsAndroid* web_contents_android = |   40   WebContentsAndroid* web_contents_android = | 
|   41       static_cast<WebContentsImpl*>(contents)->GetWebContentsAndroid(); |   41       static_cast<WebContentsImpl*>(contents)->GetWebContentsAndroid(); | 
|   42   DCHECK(!web_contents_android->synchronous_compositor_client()); |   42   DCHECK(!web_contents_android->synchronous_compositor_client()); | 
|   43   web_contents_android->set_synchronous_compositor_client(client); |   43   web_contents_android->set_synchronous_compositor_client(client); | 
|   44 } |   44 } | 
|   45  |   45  | 
|   46 // static |   46 // static | 
|   47 std::unique_ptr<SynchronousCompositorHost> SynchronousCompositorHost::Create( |   47 std::unique_ptr<SynchronousCompositorHost> SynchronousCompositorHost::Create( | 
|   48     RenderWidgetHostViewAndroid* rwhva, |   48     RenderWidgetHostViewAndroid* rwhva) { | 
|   49     WebContents* web_contents) { |   49   if (!rwhva->synchronous_compositor_client()) | 
|   50   DCHECK(web_contents); |  | 
|   51   WebContentsAndroid* web_contents_android = |  | 
|   52       static_cast<WebContentsImpl*>(web_contents)->GetWebContentsAndroid(); |  | 
|   53   if (!web_contents_android->synchronous_compositor_client()) |  | 
|   54     return nullptr;  // Not using sync compositing. |   50     return nullptr;  // Not using sync compositing. | 
|   55  |   51  | 
|   56   base::CommandLine* command_line = base::CommandLine::ForCurrentProcess(); |   52   base::CommandLine* command_line = base::CommandLine::ForCurrentProcess(); | 
|   57   bool use_in_proc_software_draw = |   53   bool use_in_proc_software_draw = | 
|   58       command_line->HasSwitch(switches::kSingleProcess); |   54       command_line->HasSwitch(switches::kSingleProcess); | 
|   59   return base::WrapUnique(new SynchronousCompositorHost( |   55   return base::WrapUnique(new SynchronousCompositorHost( | 
|   60       rwhva, web_contents_android->synchronous_compositor_client(), |   56       rwhva, use_in_proc_software_draw)); | 
|   61       use_in_proc_software_draw)); |  | 
|   62 } |   57 } | 
|   63  |   58  | 
|   64 SynchronousCompositorHost::SynchronousCompositorHost( |   59 SynchronousCompositorHost::SynchronousCompositorHost( | 
|   65     RenderWidgetHostViewAndroid* rwhva, |   60     RenderWidgetHostViewAndroid* rwhva, | 
|   66     SynchronousCompositorClient* client, |  | 
|   67     bool use_in_proc_software_draw) |   61     bool use_in_proc_software_draw) | 
|   68     : rwhva_(rwhva), |   62     : rwhva_(rwhva), | 
|   69       client_(client), |   63       client_(rwhva->synchronous_compositor_client()), | 
|   70       ui_task_runner_(BrowserThread::GetTaskRunnerForThread(BrowserThread::UI)), |   64       ui_task_runner_(BrowserThread::GetTaskRunnerForThread(BrowserThread::UI)), | 
|   71       process_id_(rwhva_->GetRenderWidgetHost()->GetProcess()->GetID()), |   65       process_id_(rwhva_->GetRenderWidgetHost()->GetProcess()->GetID()), | 
|   72       routing_id_(rwhva_->GetRenderWidgetHost()->GetRoutingID()), |   66       routing_id_(rwhva_->GetRenderWidgetHost()->GetRoutingID()), | 
|   73       sender_(rwhva_->GetRenderWidgetHost()), |   67       sender_(rwhva_->GetRenderWidgetHost()), | 
|   74       use_in_process_zero_copy_software_draw_(use_in_proc_software_draw), |   68       use_in_process_zero_copy_software_draw_(use_in_proc_software_draw), | 
|   75       bytes_limit_(0u), |   69       bytes_limit_(0u), | 
|   76       renderer_param_version_(0u), |   70       renderer_param_version_(0u), | 
|   77       need_animate_scroll_(false), |   71       need_animate_scroll_(false), | 
|   78       need_invalidate_count_(0u), |   72       need_invalidate_count_(0u), | 
|   79       did_activate_pending_tree_count_(0u) { |   73       did_activate_pending_tree_count_(0u) { | 
| (...skipping 344 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
|  424   if (params.page_scale_factor) { |  418   if (params.page_scale_factor) { | 
|  425     client_->UpdateRootLayerState( |  419     client_->UpdateRootLayerState( | 
|  426         this, gfx::ScrollOffsetToVector2dF(params.total_scroll_offset), |  420         this, gfx::ScrollOffsetToVector2dF(params.total_scroll_offset), | 
|  427         gfx::ScrollOffsetToVector2dF(params.max_scroll_offset), |  421         gfx::ScrollOffsetToVector2dF(params.max_scroll_offset), | 
|  428         params.scrollable_size, params.page_scale_factor, |  422         params.scrollable_size, params.page_scale_factor, | 
|  429         params.min_page_scale_factor, params.max_page_scale_factor); |  423         params.min_page_scale_factor, params.max_page_scale_factor); | 
|  430   } |  424   } | 
|  431 } |  425 } | 
|  432  |  426  | 
|  433 }  // namespace content |  427 }  // namespace content | 
| OLD | NEW |