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

Side by Side Diff: content/browser/compositor/gpu_process_transport_factory.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/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"
12 #include "base/metrics/histogram.h" 13 #include "base/metrics/histogram.h"
13 #include "base/profiler/scoped_tracker.h" 14 #include "base/profiler/scoped_tracker.h"
14 #include "base/single_thread_task_runner.h"
15 #include "base/thread_task_runner_handle.h"
16 #include "base/threading/simple_thread.h" 15 #include "base/threading/simple_thread.h"
17 #include "base/threading/thread.h" 16 #include "base/threading/thread.h"
18 #include "cc/output/compositor_frame.h" 17 #include "cc/output/compositor_frame.h"
19 #include "cc/output/output_surface.h" 18 #include "cc/output/output_surface.h"
20 #include "cc/raster/task_graph_runner.h" 19 #include "cc/raster/task_graph_runner.h"
21 #include "cc/surfaces/onscreen_display_client.h" 20 #include "cc/surfaces/onscreen_display_client.h"
22 #include "cc/surfaces/surface_display_output_surface.h" 21 #include "cc/surfaces/surface_display_output_surface.h"
23 #include "cc/surfaces/surface_manager.h" 22 #include "cc/surfaces/surface_manager.h"
24 #include "content/browser/compositor/browser_compositor_output_surface.h" 23 #include "content/browser/compositor/browser_compositor_output_surface.h"
25 #include "content/browser/compositor/browser_compositor_overlay_candidate_valida tor.h" 24 #include "content/browser/compositor/browser_compositor_overlay_candidate_valida tor.h"
(...skipping 562 matching lines...) Expand 10 before | Expand all | Expand 10 after
588 url, 587 url,
589 gpu_channel_host.get(), 588 gpu_channel_host.get(),
590 attrs, 589 attrs,
591 lose_context_when_out_of_memory, 590 lose_context_when_out_of_memory,
592 WebGraphicsContext3DCommandBufferImpl::SharedMemoryLimits(), 591 WebGraphicsContext3DCommandBufferImpl::SharedMemoryLimits(),
593 NULL)); 592 NULL));
594 return context.Pass(); 593 return context.Pass();
595 } 594 }
596 595
597 void GpuProcessTransportFactory::OnLostMainThreadSharedContextInsideCallback() { 596 void GpuProcessTransportFactory::OnLostMainThreadSharedContextInsideCallback() {
598 base::ThreadTaskRunnerHandle::Get()->PostTask( 597 base::MessageLoop::current()->PostTask(
599 FROM_HERE, 598 FROM_HERE,
600 base::Bind(&GpuProcessTransportFactory::OnLostMainThreadSharedContext, 599 base::Bind(&GpuProcessTransportFactory::OnLostMainThreadSharedContext,
601 callback_factory_.GetWeakPtr())); 600 callback_factory_.GetWeakPtr()));
602 } 601 }
603 602
604 void GpuProcessTransportFactory::OnLostMainThreadSharedContext() { 603 void GpuProcessTransportFactory::OnLostMainThreadSharedContext() {
605 LOG(ERROR) << "Lost UI shared context."; 604 LOG(ERROR) << "Lost UI shared context.";
606 605
607 // 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
608 // new resources are created if needed. 607 // new resources are created if needed.
609 // 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
610 // the same share group. 609 // the same share group.
611 scoped_refptr<cc::ContextProvider> lost_shared_main_thread_contexts = 610 scoped_refptr<cc::ContextProvider> lost_shared_main_thread_contexts =
612 shared_main_thread_contexts_; 611 shared_main_thread_contexts_;
613 shared_main_thread_contexts_ = NULL; 612 shared_main_thread_contexts_ = NULL;
614 613
615 scoped_ptr<GLHelper> lost_gl_helper = gl_helper_.Pass(); 614 scoped_ptr<GLHelper> lost_gl_helper = gl_helper_.Pass();
616 615
617 FOR_EACH_OBSERVER(ImageTransportFactoryObserver, 616 FOR_EACH_OBSERVER(ImageTransportFactoryObserver,
618 observer_list_, 617 observer_list_,
619 OnLostResources()); 618 OnLostResources());
620 619
621 // 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.
622 lost_gl_helper.reset(); 621 lost_gl_helper.reset();
623 lost_shared_main_thread_contexts = NULL; 622 lost_shared_main_thread_contexts = NULL;
624 } 623 }
625 624
626 } // namespace content 625 } // namespace content
OLDNEW
« no previous file with comments | « content/browser/cache_storage/cache_storage_scheduler.cc ('k') | content/browser/compositor/reflector_impl.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698