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

Side by Side Diff: content/browser/compositor/software_browser_compositor_output_surface.cc

Issue 1170623003: Revert "content: Remove use of MessageLoopProxy and deprecated MessageLoop APIs" (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 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
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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/compositor/software_browser_compositor_output_surface. h" 5 #include "content/browser/compositor/software_browser_compositor_output_surface. h"
6 6
7 #include "base/location.h"
8 #include "base/memory/ref_counted.h" 7 #include "base/memory/ref_counted.h"
9 #include "base/single_thread_task_runner.h" 8 #include "base/message_loop/message_loop.h"
10 #include "base/thread_task_runner_handle.h"
11 #include "base/time/time.h" 9 #include "base/time/time.h"
12 #include "cc/output/compositor_frame.h" 10 #include "cc/output/compositor_frame.h"
13 #include "cc/output/output_surface_client.h" 11 #include "cc/output/output_surface_client.h"
14 #include "cc/output/software_output_device.h" 12 #include "cc/output/software_output_device.h"
15 #include "content/browser/renderer_host/render_widget_host_impl.h" 13 #include "content/browser/renderer_host/render_widget_host_impl.h"
16 #include "ui/events/latency_info.h" 14 #include "ui/events/latency_info.h"
17 #include "ui/gfx/vsync_provider.h" 15 #include "ui/gfx/vsync_provider.h"
18 16
19 namespace content { 17 namespace content {
20 18
(...skipping 12 matching lines...) Expand all
33 void SoftwareBrowserCompositorOutputSurface::SwapBuffers( 31 void SoftwareBrowserCompositorOutputSurface::SwapBuffers(
34 cc::CompositorFrame* frame) { 32 cc::CompositorFrame* frame) {
35 base::TimeTicks swap_time = base::TimeTicks::Now(); 33 base::TimeTicks swap_time = base::TimeTicks::Now();
36 for (auto& latency : frame->metadata.latency_info) { 34 for (auto& latency : frame->metadata.latency_info) {
37 latency.AddLatencyNumberWithTimestamp( 35 latency.AddLatencyNumberWithTimestamp(
38 ui::INPUT_EVENT_GPU_SWAP_BUFFER_COMPONENT, 0, 0, swap_time, 1); 36 ui::INPUT_EVENT_GPU_SWAP_BUFFER_COMPONENT, 0, 0, swap_time, 1);
39 latency.AddLatencyNumberWithTimestamp( 37 latency.AddLatencyNumberWithTimestamp(
40 ui::INPUT_EVENT_LATENCY_TERMINATED_FRAME_SWAP_COMPONENT, 0, 0, 38 ui::INPUT_EVENT_LATENCY_TERMINATED_FRAME_SWAP_COMPONENT, 0, 0,
41 swap_time, 1); 39 swap_time, 1);
42 } 40 }
43 base::ThreadTaskRunnerHandle::Get()->PostTask( 41 base::MessageLoop::current()->PostTask(
44 FROM_HERE, base::Bind(&RenderWidgetHostImpl::CompositorFrameDrawn, 42 FROM_HERE,
45 frame->metadata.latency_info)); 43 base::Bind(
44 &RenderWidgetHostImpl::CompositorFrameDrawn,
45 frame->metadata.latency_info));
46 46
47 gfx::VSyncProvider* vsync_provider = software_device()->GetVSyncProvider(); 47 gfx::VSyncProvider* vsync_provider = software_device()->GetVSyncProvider();
48 if (vsync_provider) { 48 if (vsync_provider) {
49 vsync_provider->GetVSyncParameters(base::Bind( 49 vsync_provider->GetVSyncParameters(base::Bind(
50 &BrowserCompositorOutputSurface::OnUpdateVSyncParametersFromGpu, 50 &BrowserCompositorOutputSurface::OnUpdateVSyncParametersFromGpu,
51 weak_factory_.GetWeakPtr())); 51 weak_factory_.GetWeakPtr()));
52 } 52 }
53 PostSwapBuffersComplete(); 53 PostSwapBuffersComplete();
54 client_->DidSwapBuffers(); 54 client_->DidSwapBuffers();
55 } 55 }
56 56
57 #if defined(OS_MACOSX) 57 #if defined(OS_MACOSX)
58 void SoftwareBrowserCompositorOutputSurface::OnSurfaceDisplayed() { 58 void SoftwareBrowserCompositorOutputSurface::OnSurfaceDisplayed() {
59 // See GpuBrowserCompositorOutputSurface for when and how this is used. 59 // See GpuBrowserCompositorOutputSurface for when and how this is used.
60 NOTREACHED() << "Not expected for software surfaces."; 60 NOTREACHED() << "Not expected for software surfaces.";
61 } 61 }
62 62
63 void SoftwareBrowserCompositorOutputSurface::SetSurfaceSuspendedForRecycle( 63 void SoftwareBrowserCompositorOutputSurface::SetSurfaceSuspendedForRecycle(
64 bool suspended) { 64 bool suspended) {
65 } 65 }
66 66
67 bool SoftwareBrowserCompositorOutputSurface:: 67 bool SoftwareBrowserCompositorOutputSurface::
68 SurfaceShouldNotShowFramesAfterSuspendForRecycle() const { 68 SurfaceShouldNotShowFramesAfterSuspendForRecycle() const {
69 return false; 69 return false;
70 } 70 }
71 #endif 71 #endif
72 72
73 } // namespace content 73 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698