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

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

Issue 1159623009: 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/gpu_process_transport_factory.h" 5 #include "content/browser/compositor/gpu_process_transport_factory.h"
6 6
7 #include <string> 7 #include <string>
8 8
9 #include "base/bind.h" 9 #include "base/bind.h"
10 #include "base/command_line.h" 10 #include "base/command_line.h"
11 #include "base/location.h" 11 #include "base/location.h"
12 #include "base/message_loop/message_loop.h"
13 #include "base/metrics/histogram.h" 12 #include "base/metrics/histogram.h"
14 #include "base/profiler/scoped_tracker.h" 13 #include "base/profiler/scoped_tracker.h"
14 #include "base/single_thread_task_runner.h"
15 #include "base/thread_task_runner_handle.h"
15 #include "base/threading/simple_thread.h" 16 #include "base/threading/simple_thread.h"
16 #include "base/threading/thread.h" 17 #include "base/threading/thread.h"
17 #include "cc/output/compositor_frame.h" 18 #include "cc/output/compositor_frame.h"
18 #include "cc/output/output_surface.h" 19 #include "cc/output/output_surface.h"
19 #include "cc/raster/task_graph_runner.h" 20 #include "cc/raster/task_graph_runner.h"
20 #include "cc/surfaces/onscreen_display_client.h" 21 #include "cc/surfaces/onscreen_display_client.h"
21 #include "cc/surfaces/surface_display_output_surface.h" 22 #include "cc/surfaces/surface_display_output_surface.h"
22 #include "cc/surfaces/surface_manager.h" 23 #include "cc/surfaces/surface_manager.h"
23 #include "content/browser/compositor/browser_compositor_output_surface.h" 24 #include "content/browser/compositor/browser_compositor_output_surface.h"
24 #include "content/browser/compositor/browser_compositor_overlay_candidate_valida tor.h" 25 #include "content/browser/compositor/browser_compositor_overlay_candidate_valida tor.h"
(...skipping 561 matching lines...) Expand 10 before | Expand all | Expand 10 after
586 url, 587 url,
587 gpu_channel_host.get(), 588 gpu_channel_host.get(),
588 attrs, 589 attrs,
589 lose_context_when_out_of_memory, 590 lose_context_when_out_of_memory,
590 WebGraphicsContext3DCommandBufferImpl::SharedMemoryLimits(), 591 WebGraphicsContext3DCommandBufferImpl::SharedMemoryLimits(),
591 NULL)); 592 NULL));
592 return context.Pass(); 593 return context.Pass();
593 } 594 }
594 595
595 void GpuProcessTransportFactory::OnLostMainThreadSharedContextInsideCallback() { 596 void GpuProcessTransportFactory::OnLostMainThreadSharedContextInsideCallback() {
596 base::MessageLoop::current()->PostTask( 597 base::ThreadTaskRunnerHandle::Get()->PostTask(
597 FROM_HERE, 598 FROM_HERE,
598 base::Bind(&GpuProcessTransportFactory::OnLostMainThreadSharedContext, 599 base::Bind(&GpuProcessTransportFactory::OnLostMainThreadSharedContext,
599 callback_factory_.GetWeakPtr())); 600 callback_factory_.GetWeakPtr()));
600 } 601 }
601 602
602 void GpuProcessTransportFactory::OnLostMainThreadSharedContext() { 603 void GpuProcessTransportFactory::OnLostMainThreadSharedContext() {
603 LOG(ERROR) << "Lost UI shared context."; 604 LOG(ERROR) << "Lost UI shared context.";
604 605
605 // Keep old resources around while we call the observers, but ensure that 606 // Keep old resources around while we call the observers, but ensure that
606 // new resources are created if needed. 607 // new resources are created if needed.
607 // Kill shared contexts for both threads in tandem so they are always in 608 // Kill shared contexts for both threads in tandem so they are always in
608 // the same share group. 609 // the same share group.
609 scoped_refptr<cc::ContextProvider> lost_shared_main_thread_contexts = 610 scoped_refptr<cc::ContextProvider> lost_shared_main_thread_contexts =
610 shared_main_thread_contexts_; 611 shared_main_thread_contexts_;
611 shared_main_thread_contexts_ = NULL; 612 shared_main_thread_contexts_ = NULL;
612 613
613 scoped_ptr<GLHelper> lost_gl_helper = gl_helper_.Pass(); 614 scoped_ptr<GLHelper> lost_gl_helper = gl_helper_.Pass();
614 615
615 FOR_EACH_OBSERVER(ImageTransportFactoryObserver, 616 FOR_EACH_OBSERVER(ImageTransportFactoryObserver,
616 observer_list_, 617 observer_list_,
617 OnLostResources()); 618 OnLostResources());
618 619
619 // Kill things that use the shared context before killing the shared context. 620 // Kill things that use the shared context before killing the shared context.
620 lost_gl_helper.reset(); 621 lost_gl_helper.reset();
621 lost_shared_main_thread_contexts = NULL; 622 lost_shared_main_thread_contexts = NULL;
622 } 623 }
623 624
624 } // namespace content 625 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698