| 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_base.h" | 5 #include "content/browser/android/synchronous_compositor_base.h" |
| 6 | 6 |
| 7 #include "base/command_line.h" | 7 #include "base/command_line.h" |
| 8 #include "base/memory/ptr_util.h" |
| 8 #include "base/supports_user_data.h" | 9 #include "base/supports_user_data.h" |
| 9 #include "content/browser/android/in_process/synchronous_compositor_factory_impl
.h" | 10 #include "content/browser/android/in_process/synchronous_compositor_factory_impl
.h" |
| 10 #include "content/browser/android/in_process/synchronous_compositor_impl.h" | 11 #include "content/browser/android/in_process/synchronous_compositor_impl.h" |
| 11 #include "content/browser/android/synchronous_compositor_host.h" | 12 #include "content/browser/android/synchronous_compositor_host.h" |
| 12 #include "content/browser/gpu/gpu_process_host.h" | 13 #include "content/browser/gpu/gpu_process_host.h" |
| 13 #include "content/browser/web_contents/web_contents_android.h" | 14 #include "content/browser/web_contents/web_contents_android.h" |
| 14 #include "content/browser/web_contents/web_contents_impl.h" | 15 #include "content/browser/web_contents/web_contents_impl.h" |
| 15 #include "content/gpu/in_process_gpu_thread.h" | 16 #include "content/gpu/in_process_gpu_thread.h" |
| 16 #include "content/public/common/content_switches.h" | 17 #include "content/public/common/content_switches.h" |
| 17 | 18 |
| (...skipping 30 matching lines...) Expand all Loading... |
| 48 SynchronousCompositorClient* client) { | 49 SynchronousCompositorClient* client) { |
| 49 DCHECK(contents); | 50 DCHECK(contents); |
| 50 DCHECK(client); | 51 DCHECK(client); |
| 51 WebContentsAndroid* web_contents_android = | 52 WebContentsAndroid* web_contents_android = |
| 52 static_cast<WebContentsImpl*>(contents)->GetWebContentsAndroid(); | 53 static_cast<WebContentsImpl*>(contents)->GetWebContentsAndroid(); |
| 53 DCHECK(!web_contents_android->synchronous_compositor_client()); | 54 DCHECK(!web_contents_android->synchronous_compositor_client()); |
| 54 web_contents_android->set_synchronous_compositor_client(client); | 55 web_contents_android->set_synchronous_compositor_client(client); |
| 55 } | 56 } |
| 56 | 57 |
| 57 // static | 58 // static |
| 58 scoped_ptr<SynchronousCompositorBase> SynchronousCompositorBase::Create( | 59 std::unique_ptr<SynchronousCompositorBase> SynchronousCompositorBase::Create( |
| 59 RenderWidgetHostViewAndroid* rwhva, | 60 RenderWidgetHostViewAndroid* rwhva, |
| 60 WebContents* web_contents) { | 61 WebContents* web_contents) { |
| 61 DCHECK(web_contents); | 62 DCHECK(web_contents); |
| 62 WebContentsAndroid* web_contents_android = | 63 WebContentsAndroid* web_contents_android = |
| 63 static_cast<WebContentsImpl*>(web_contents)->GetWebContentsAndroid(); | 64 static_cast<WebContentsImpl*>(web_contents)->GetWebContentsAndroid(); |
| 64 if (!web_contents_android->synchronous_compositor_client()) | 65 if (!web_contents_android->synchronous_compositor_client()) |
| 65 return nullptr; // Not using sync compositing. | 66 return nullptr; // Not using sync compositing. |
| 66 | 67 |
| 67 base::CommandLine* command_line = base::CommandLine::ForCurrentProcess(); | 68 base::CommandLine* command_line = base::CommandLine::ForCurrentProcess(); |
| 68 if (command_line->HasSwitch(switches::kIPCSyncCompositing)) { | 69 if (command_line->HasSwitch(switches::kIPCSyncCompositing)) { |
| 69 bool async_input = | 70 bool async_input = |
| 70 !command_line->HasSwitch(switches::kSyncInputForSyncCompositor); | 71 !command_line->HasSwitch(switches::kSyncInputForSyncCompositor); |
| 71 bool use_in_proc_software_draw = | 72 bool use_in_proc_software_draw = |
| 72 command_line->HasSwitch(switches::kSingleProcess); | 73 command_line->HasSwitch(switches::kSingleProcess); |
| 73 return make_scoped_ptr(new SynchronousCompositorHost( | 74 return base::WrapUnique(new SynchronousCompositorHost( |
| 74 rwhva, web_contents_android->synchronous_compositor_client(), | 75 rwhva, web_contents_android->synchronous_compositor_client(), |
| 75 async_input, use_in_proc_software_draw)); | 76 async_input, use_in_proc_software_draw)); |
| 76 } | 77 } |
| 77 return make_scoped_ptr(new SynchronousCompositorImpl( | 78 return base::WrapUnique(new SynchronousCompositorImpl( |
| 78 rwhva, web_contents_android->synchronous_compositor_client())); | 79 rwhva, web_contents_android->synchronous_compositor_client())); |
| 79 } | 80 } |
| 80 | 81 |
| 81 } // namespace content | 82 } // namespace content |
| OLD | NEW |