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

Side by Side Diff: content/gpu/gpu_main.cc

Issue 1210703002: content: Make sure all CreateGpuMemoryBuffer messages are handled. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: avoid use of g_thread_safe_sender Created 5 years, 5 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
« no previous file with comments | « content/gpu/gpu_child_thread.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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 <stdlib.h> 5 #include <stdlib.h>
6 6
7 #if defined(OS_WIN) 7 #if defined(OS_WIN)
8 #include <dwmapi.h> 8 #include <dwmapi.h>
9 #include <windows.h> 9 #include <windows.h>
10 #endif 10 #endif
11 11
12 #include "base/lazy_instance.h" 12 #include "base/lazy_instance.h"
13 #include "base/message_loop/message_loop.h" 13 #include "base/message_loop/message_loop.h"
14 #include "base/metrics/histogram.h" 14 #include "base/metrics/histogram.h"
15 #include "base/metrics/statistics_recorder.h" 15 #include "base/metrics/statistics_recorder.h"
16 #include "base/rand_util.h" 16 #include "base/rand_util.h"
17 #include "base/strings/string_number_conversions.h" 17 #include "base/strings/string_number_conversions.h"
18 #include "base/strings/stringprintf.h" 18 #include "base/strings/stringprintf.h"
19 #include "base/third_party/dynamic_annotations/dynamic_annotations.h" 19 #include "base/third_party/dynamic_annotations/dynamic_annotations.h"
20 #include "base/threading/platform_thread.h" 20 #include "base/threading/platform_thread.h"
21 #include "base/trace_event/trace_event.h" 21 #include "base/trace_event/trace_event.h"
22 #include "build/build_config.h" 22 #include "build/build_config.h"
23 #include "content/child/child_process.h" 23 #include "content/child/child_process.h"
24 #include "content/common/content_constants_internal.h" 24 #include "content/common/content_constants_internal.h"
25 #include "content/common/gpu/gpu_config.h" 25 #include "content/common/gpu/gpu_config.h"
26 #include "content/common/gpu/gpu_memory_buffer_factory.h"
26 #include "content/common/gpu/gpu_messages.h" 27 #include "content/common/gpu/gpu_messages.h"
27 #include "content/common/gpu/media/gpu_video_decode_accelerator.h" 28 #include "content/common/gpu/media/gpu_video_decode_accelerator.h"
28 #include "content/common/gpu/media/gpu_video_encode_accelerator.h" 29 #include "content/common/gpu/media/gpu_video_encode_accelerator.h"
29 #include "content/common/sandbox_linux/sandbox_linux.h" 30 #include "content/common/sandbox_linux/sandbox_linux.h"
30 #include "content/gpu/gpu_child_thread.h" 31 #include "content/gpu/gpu_child_thread.h"
31 #include "content/gpu/gpu_process.h" 32 #include "content/gpu/gpu_process.h"
32 #include "content/gpu/gpu_watchdog_thread.h" 33 #include "content/gpu/gpu_watchdog_thread.h"
33 #include "content/public/common/content_client.h" 34 #include "content/public/common/content_client.h"
34 #include "content/public/common/content_switches.h" 35 #include "content/public/common/content_switches.h"
35 #include "content/public/common/main_function_params.h" 36 #include "content/public/common/main_function_params.h"
(...skipping 321 matching lines...) Expand 10 before | Expand all | Expand 10 after
357 gpu_info.video_decode_accelerator_supported_profiles = 358 gpu_info.video_decode_accelerator_supported_profiles =
358 content::GpuVideoDecodeAccelerator::GetSupportedProfiles(); 359 content::GpuVideoDecodeAccelerator::GetSupportedProfiles();
359 gpu_info.video_encode_accelerator_supported_profiles = 360 gpu_info.video_encode_accelerator_supported_profiles =
360 content::GpuVideoEncodeAccelerator::GetSupportedProfiles(); 361 content::GpuVideoEncodeAccelerator::GetSupportedProfiles();
361 } else { 362 } else {
362 dead_on_arrival = true; 363 dead_on_arrival = true;
363 } 364 }
364 365
365 logging::SetLogMessageHandler(NULL); 366 logging::SetLogMessageHandler(NULL);
366 367
368 std::vector<gfx::GpuMemoryBufferType> supported_types;
369 GpuMemoryBufferFactory::GetSupportedTypes(&supported_types);
370 DCHECK(!supported_types.empty());
371 // Note: We always use the preferred type.
372 scoped_ptr<GpuMemoryBufferFactory> gpu_memory_buffer_factory =
373 GpuMemoryBufferFactory::Create(supported_types[0]);
374
367 GpuProcess gpu_process; 375 GpuProcess gpu_process;
368 376
369 GpuChildThread* child_thread = new GpuChildThread(watchdog_thread.get(), 377 GpuChildThread* child_thread = new GpuChildThread(
370 dead_on_arrival, 378 watchdog_thread.get(), dead_on_arrival, gpu_info, deferred_messages.Get(),
371 gpu_info, 379 gpu_memory_buffer_factory.get());
372 deferred_messages.Get());
373 while (!deferred_messages.Get().empty()) 380 while (!deferred_messages.Get().empty())
374 deferred_messages.Get().pop(); 381 deferred_messages.Get().pop();
375 382
376 child_thread->Init(start_time); 383 child_thread->Init(start_time);
377 384
378 gpu_process.set_main_thread(child_thread); 385 gpu_process.set_main_thread(child_thread);
379 386
380 if (watchdog_thread.get()) 387 if (watchdog_thread.get())
381 watchdog_thread->AddPowerObserver(); 388 watchdog_thread->AddPowerObserver();
382 389
(...skipping 170 matching lines...) Expand 10 before | Expand all | Expand 10 after
553 return true; 560 return true;
554 } 561 }
555 562
556 return false; 563 return false;
557 } 564 }
558 #endif // defined(OS_WIN) 565 #endif // defined(OS_WIN)
559 566
560 } // namespace. 567 } // namespace.
561 568
562 } // namespace content 569 } // namespace content
OLDNEW
« no previous file with comments | « content/gpu/gpu_child_thread.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698