OLD | NEW |
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 "content/renderer/render_thread_impl.h" | 5 #include "content/renderer/render_thread_impl.h" |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
8 #include <limits> | 8 #include <limits> |
9 #include <map> | 9 #include <map> |
10 #include <utility> | 10 #include <utility> |
11 #include <vector> | 11 #include <vector> |
12 | 12 |
13 #include "base/allocator/allocator_extension.h" | 13 #include "base/allocator/allocator_extension.h" |
14 #include "base/command_line.h" | 14 #include "base/command_line.h" |
15 #include "base/debug/crash_logging.h" | 15 #include "base/debug/crash_logging.h" |
16 #include "base/lazy_instance.h" | 16 #include "base/lazy_instance.h" |
17 #include "base/location.h" | 17 #include "base/location.h" |
18 #include "base/logging.h" | 18 #include "base/logging.h" |
19 #include "base/macros.h" | 19 #include "base/macros.h" |
20 #include "base/memory/discardable_memory_allocator.h" | 20 #include "base/memory/discardable_memory_allocator.h" |
| 21 #include "base/memory/ptr_util.h" |
21 #include "base/memory/shared_memory.h" | 22 #include "base/memory/shared_memory.h" |
22 #include "base/metrics/field_trial.h" | 23 #include "base/metrics/field_trial.h" |
23 #include "base/metrics/histogram.h" | 24 #include "base/metrics/histogram.h" |
24 #include "base/path_service.h" | 25 #include "base/path_service.h" |
25 #include "base/single_thread_task_runner.h" | 26 #include "base/single_thread_task_runner.h" |
26 #include "base/strings/string16.h" | 27 #include "base/strings/string16.h" |
27 #include "base/strings/string_number_conversions.h" | 28 #include "base/strings/string_number_conversions.h" |
28 #include "base/strings/string_split.h" | 29 #include "base/strings/string_split.h" |
29 #include "base/strings/string_tokenizer.h" | 30 #include "base/strings/string_tokenizer.h" |
30 #include "base/strings/sys_string_conversions.h" | 31 #include "base/strings/sys_string_conversions.h" |
(...skipping 213 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
244 class WebThreadForCompositor : public WebThreadImplForWorkerScheduler { | 245 class WebThreadForCompositor : public WebThreadImplForWorkerScheduler { |
245 public: | 246 public: |
246 explicit WebThreadForCompositor(base::Thread::Options options) | 247 explicit WebThreadForCompositor(base::Thread::Options options) |
247 : WebThreadImplForWorkerScheduler("Compositor", options) { | 248 : WebThreadImplForWorkerScheduler("Compositor", options) { |
248 Init(); | 249 Init(); |
249 } | 250 } |
250 ~WebThreadForCompositor() override {} | 251 ~WebThreadForCompositor() override {} |
251 | 252 |
252 private: | 253 private: |
253 // WebThreadImplForWorkerScheduler: | 254 // WebThreadImplForWorkerScheduler: |
254 scoped_ptr<scheduler::WorkerScheduler> CreateWorkerScheduler() override { | 255 std::unique_ptr<scheduler::WorkerScheduler> CreateWorkerScheduler() override { |
255 return make_scoped_ptr(new scheduler::CompositorWorkerScheduler(thread())); | 256 return base::WrapUnique(new scheduler::CompositorWorkerScheduler(thread())); |
256 } | 257 } |
257 | 258 |
258 DISALLOW_COPY_AND_ASSIGN(WebThreadForCompositor); | 259 DISALLOW_COPY_AND_ASSIGN(WebThreadForCompositor); |
259 }; | 260 }; |
260 | 261 |
261 class RenderViewZoomer : public RenderViewVisitor { | 262 class RenderViewZoomer : public RenderViewVisitor { |
262 public: | 263 public: |
263 RenderViewZoomer(const std::string& scheme, | 264 RenderViewZoomer(const std::string& scheme, |
264 const std::string& host, | 265 const std::string& host, |
265 double zoom_level) : scheme_(scheme), | 266 double zoom_level) : scheme_(scheme), |
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
319 histogram_name, min, max, buckets, | 320 histogram_name, min, max, buckets, |
320 base::Histogram::kUmaTargetedHistogramFlag); | 321 base::Histogram::kUmaTargetedHistogramFlag); |
321 return histogram; | 322 return histogram; |
322 } | 323 } |
323 | 324 |
324 void AddHistogramSample(void* hist, int sample) { | 325 void AddHistogramSample(void* hist, int sample) { |
325 base::Histogram* histogram = static_cast<base::Histogram*>(hist); | 326 base::Histogram* histogram = static_cast<base::Histogram*>(hist); |
326 histogram->Add(sample); | 327 histogram->Add(sample); |
327 } | 328 } |
328 | 329 |
329 scoped_ptr<cc::SharedBitmap> AllocateSharedBitmapFunction( | 330 std::unique_ptr<cc::SharedBitmap> AllocateSharedBitmapFunction( |
330 const gfx::Size& size) { | 331 const gfx::Size& size) { |
331 return ChildThreadImpl::current()->shared_bitmap_manager()-> | 332 return ChildThreadImpl::current()->shared_bitmap_manager()-> |
332 AllocateSharedBitmap(size); | 333 AllocateSharedBitmap(size); |
333 } | 334 } |
334 | 335 |
335 void EnableBlinkPlatformLogChannels(const std::string& channels) { | 336 void EnableBlinkPlatformLogChannels(const std::string& channels) { |
336 if (channels.empty()) | 337 if (channels.empty()) |
337 return; | 338 return; |
338 base::StringTokenizer t(channels, ", "); | 339 base::StringTokenizer t(channels, ", "); |
339 while (t.GetNext()) | 340 while (t.GetNext()) |
(...skipping 223 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
563 return true; | 564 return true; |
564 } | 565 } |
565 } | 566 } |
566 } | 567 } |
567 return false; | 568 return false; |
568 } | 569 } |
569 | 570 |
570 // static | 571 // static |
571 RenderThreadImpl* RenderThreadImpl::Create( | 572 RenderThreadImpl* RenderThreadImpl::Create( |
572 const InProcessChildThreadParams& params) { | 573 const InProcessChildThreadParams& params) { |
573 scoped_ptr<scheduler::RendererScheduler> renderer_scheduler = | 574 std::unique_ptr<scheduler::RendererScheduler> renderer_scheduler = |
574 scheduler::RendererScheduler::Create(); | 575 scheduler::RendererScheduler::Create(); |
575 scoped_refptr<base::SingleThreadTaskRunner> test_task_counter; | 576 scoped_refptr<base::SingleThreadTaskRunner> test_task_counter; |
576 return new RenderThreadImpl( | 577 return new RenderThreadImpl( |
577 params, std::move(renderer_scheduler), test_task_counter); | 578 params, std::move(renderer_scheduler), test_task_counter); |
578 } | 579 } |
579 | 580 |
580 // static | 581 // static |
581 RenderThreadImpl* RenderThreadImpl::Create( | 582 RenderThreadImpl* RenderThreadImpl::Create( |
582 scoped_ptr<base::MessageLoop> main_message_loop, | 583 std::unique_ptr<base::MessageLoop> main_message_loop, |
583 scoped_ptr<scheduler::RendererScheduler> renderer_scheduler) { | 584 std::unique_ptr<scheduler::RendererScheduler> renderer_scheduler) { |
584 return new RenderThreadImpl(std::move(main_message_loop), | 585 return new RenderThreadImpl(std::move(main_message_loop), |
585 std::move(renderer_scheduler)); | 586 std::move(renderer_scheduler)); |
586 } | 587 } |
587 | 588 |
588 RenderThreadImpl* RenderThreadImpl::current() { | 589 RenderThreadImpl* RenderThreadImpl::current() { |
589 return lazy_tls.Pointer()->Get(); | 590 return lazy_tls.Pointer()->Get(); |
590 } | 591 } |
591 | 592 |
592 RenderThreadImpl::RenderThreadImpl( | 593 RenderThreadImpl::RenderThreadImpl( |
593 const InProcessChildThreadParams& params, | 594 const InProcessChildThreadParams& params, |
594 scoped_ptr<scheduler::RendererScheduler> scheduler, | 595 std::unique_ptr<scheduler::RendererScheduler> scheduler, |
595 scoped_refptr<base::SingleThreadTaskRunner>& resource_task_queue) | 596 scoped_refptr<base::SingleThreadTaskRunner>& resource_task_queue) |
596 : ChildThreadImpl(Options::Builder() | 597 : ChildThreadImpl(Options::Builder() |
597 .InBrowserProcess(params) | 598 .InBrowserProcess(params) |
598 .UseMojoChannel(ShouldUseMojoChannel()) | 599 .UseMojoChannel(ShouldUseMojoChannel()) |
599 .Build()), | 600 .Build()), |
600 renderer_scheduler_(std::move(scheduler)), | 601 renderer_scheduler_(std::move(scheduler)), |
601 raster_worker_pool_(new RasterWorkerPool()) { | 602 raster_worker_pool_(new RasterWorkerPool()) { |
602 Init(resource_task_queue); | 603 Init(resource_task_queue); |
603 } | 604 } |
604 | 605 |
605 // When we run plugins in process, we actually run them on the render thread, | 606 // When we run plugins in process, we actually run them on the render thread, |
606 // which means that we need to make the render thread pump UI events. | 607 // which means that we need to make the render thread pump UI events. |
607 RenderThreadImpl::RenderThreadImpl( | 608 RenderThreadImpl::RenderThreadImpl( |
608 scoped_ptr<base::MessageLoop> main_message_loop, | 609 std::unique_ptr<base::MessageLoop> main_message_loop, |
609 scoped_ptr<scheduler::RendererScheduler> scheduler) | 610 std::unique_ptr<scheduler::RendererScheduler> scheduler) |
610 : ChildThreadImpl(Options::Builder() | 611 : ChildThreadImpl( |
611 .UseMojoChannel(ShouldUseMojoChannel()) | 612 Options::Builder().UseMojoChannel(ShouldUseMojoChannel()).Build()), |
612 .Build()), | |
613 renderer_scheduler_(std::move(scheduler)), | 613 renderer_scheduler_(std::move(scheduler)), |
614 main_message_loop_(std::move(main_message_loop)), | 614 main_message_loop_(std::move(main_message_loop)), |
615 raster_worker_pool_(new RasterWorkerPool()) { | 615 raster_worker_pool_(new RasterWorkerPool()) { |
616 scoped_refptr<base::SingleThreadTaskRunner> test_task_counter; | 616 scoped_refptr<base::SingleThreadTaskRunner> test_task_counter; |
617 Init(test_task_counter); | 617 Init(test_task_counter); |
618 } | 618 } |
619 | 619 |
620 void RenderThreadImpl::Init( | 620 void RenderThreadImpl::Init( |
621 scoped_refptr<base::SingleThreadTaskRunner>& resource_task_queue) { | 621 scoped_refptr<base::SingleThreadTaskRunner>& resource_task_queue) { |
622 TRACE_EVENT0("startup", "RenderThreadImpl::Init"); | 622 TRACE_EVENT0("startup", "RenderThreadImpl::Init"); |
(...skipping 709 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1332 } | 1332 } |
1333 | 1333 |
1334 void RenderThreadImpl::RecordAction(const base::UserMetricsAction& action) { | 1334 void RenderThreadImpl::RecordAction(const base::UserMetricsAction& action) { |
1335 Send(new ViewHostMsg_UserMetricsRecordAction(action.str_)); | 1335 Send(new ViewHostMsg_UserMetricsRecordAction(action.str_)); |
1336 } | 1336 } |
1337 | 1337 |
1338 void RenderThreadImpl::RecordComputedAction(const std::string& action) { | 1338 void RenderThreadImpl::RecordComputedAction(const std::string& action) { |
1339 Send(new ViewHostMsg_UserMetricsRecordAction(action)); | 1339 Send(new ViewHostMsg_UserMetricsRecordAction(action)); |
1340 } | 1340 } |
1341 | 1341 |
1342 scoped_ptr<base::SharedMemory> | 1342 std::unique_ptr<base::SharedMemory> |
1343 RenderThreadImpl::HostAllocateSharedMemoryBuffer(size_t size) { | 1343 RenderThreadImpl::HostAllocateSharedMemoryBuffer(size_t size) { |
1344 return ChildThreadImpl::AllocateSharedMemory(size, thread_safe_sender()); | 1344 return ChildThreadImpl::AllocateSharedMemory(size, thread_safe_sender()); |
1345 } | 1345 } |
1346 | 1346 |
1347 cc::SharedBitmapManager* RenderThreadImpl::GetSharedBitmapManager() { | 1347 cc::SharedBitmapManager* RenderThreadImpl::GetSharedBitmapManager() { |
1348 return shared_bitmap_manager(); | 1348 return shared_bitmap_manager(); |
1349 } | 1349 } |
1350 | 1350 |
1351 void RenderThreadImpl::RegisterExtension(v8::Extension* extension) { | 1351 void RenderThreadImpl::RegisterExtension(v8::Extension* extension) { |
1352 WebScriptController::registerExtension(extension); | 1352 WebScriptController::registerExtension(extension); |
1353 } | 1353 } |
(...skipping 128 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1482 gpu_factories_.push_back(RendererGpuVideoAcceleratorFactories::Create( | 1482 gpu_factories_.push_back(RendererGpuVideoAcceleratorFactories::Create( |
1483 gpu_channel_host.get(), base::ThreadTaskRunnerHandle::Get(), | 1483 gpu_channel_host.get(), base::ThreadTaskRunnerHandle::Get(), |
1484 media_task_runner, shared_context_provider, | 1484 media_task_runner, shared_context_provider, |
1485 enable_gpu_memory_buffer_video_frames, image_texture_targets, | 1485 enable_gpu_memory_buffer_video_frames, image_texture_targets, |
1486 enable_video_accelerator)); | 1486 enable_video_accelerator)); |
1487 return gpu_factories_.back(); | 1487 return gpu_factories_.back(); |
1488 } | 1488 } |
1489 return nullptr; | 1489 return nullptr; |
1490 } | 1490 } |
1491 | 1491 |
1492 scoped_ptr<WebGraphicsContext3DCommandBufferImpl> | 1492 std::unique_ptr<WebGraphicsContext3DCommandBufferImpl> |
1493 RenderThreadImpl::CreateOffscreenContext3d() { | 1493 RenderThreadImpl::CreateOffscreenContext3d() { |
1494 // This is used to create a few different offscreen contexts: | 1494 // This is used to create a few different offscreen contexts: |
1495 // - The shared main thread context (offscreen) used by blink for canvas | 1495 // - The shared main thread context (offscreen) used by blink for canvas |
1496 // - The worker context (offscreen) used for GPU raster and video decoding. | 1496 // - The worker context (offscreen) used for GPU raster and video decoding. |
1497 // This is for an offscreen context, so the default framebuffer doesn't need | 1497 // This is for an offscreen context, so the default framebuffer doesn't need |
1498 // alpha, depth, stencil, antialiasing. | 1498 // alpha, depth, stencil, antialiasing. |
1499 gpu::gles2::ContextCreationAttribHelper attributes; | 1499 gpu::gles2::ContextCreationAttribHelper attributes; |
1500 attributes.alpha_size = -1; | 1500 attributes.alpha_size = -1; |
1501 attributes.depth_size = 0; | 1501 attributes.depth_size = 0; |
1502 attributes.stencil_size = 0; | 1502 attributes.stencil_size = 0; |
1503 attributes.samples = 0; | 1503 attributes.samples = 0; |
1504 attributes.sample_buffers = 0; | 1504 attributes.sample_buffers = 0; |
1505 attributes.bind_generates_resource = false; | 1505 attributes.bind_generates_resource = false; |
1506 attributes.lose_context_when_out_of_memory = true; | 1506 attributes.lose_context_when_out_of_memory = true; |
1507 bool share_resources = true; | 1507 bool share_resources = true; |
1508 bool automatic_flushes = false; | 1508 bool automatic_flushes = false; |
1509 scoped_refptr<gpu::GpuChannelHost> gpu_channel_host(EstablishGpuChannelSync( | 1509 scoped_refptr<gpu::GpuChannelHost> gpu_channel_host(EstablishGpuChannelSync( |
1510 CAUSE_FOR_GPU_LAUNCH_WEBGRAPHICSCONTEXT3DCOMMANDBUFFERIMPL_INITIALIZE)); | 1510 CAUSE_FOR_GPU_LAUNCH_WEBGRAPHICSCONTEXT3DCOMMANDBUFFERIMPL_INITIALIZE)); |
1511 return make_scoped_ptr( | 1511 return base::WrapUnique( |
1512 WebGraphicsContext3DCommandBufferImpl::CreateOffscreenContext( | 1512 WebGraphicsContext3DCommandBufferImpl::CreateOffscreenContext( |
1513 gpu_channel_host.get(), attributes, gfx::PreferIntegratedGpu, | 1513 gpu_channel_host.get(), attributes, gfx::PreferIntegratedGpu, |
1514 share_resources, automatic_flushes, | 1514 share_resources, automatic_flushes, |
1515 GURL("chrome://gpu/RenderThreadImpl::CreateOffscreenContext3d"), | 1515 GURL("chrome://gpu/RenderThreadImpl::CreateOffscreenContext3d"), |
1516 WebGraphicsContext3DCommandBufferImpl::SharedMemoryLimits(), NULL)); | 1516 WebGraphicsContext3DCommandBufferImpl::SharedMemoryLimits(), NULL)); |
1517 } | 1517 } |
1518 | 1518 |
1519 scoped_refptr<cc_blink::ContextProviderWebContext> | 1519 scoped_refptr<cc_blink::ContextProviderWebContext> |
1520 RenderThreadImpl::SharedMainThreadContextProvider() { | 1520 RenderThreadImpl::SharedMainThreadContextProvider() { |
1521 DCHECK(IsMainThread()); | 1521 DCHECK(IsMainThread()); |
(...skipping 147 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1669 } | 1669 } |
1670 | 1670 |
1671 scheduler::RendererScheduler* RenderThreadImpl::GetRendererScheduler() { | 1671 scheduler::RendererScheduler* RenderThreadImpl::GetRendererScheduler() { |
1672 return renderer_scheduler_.get(); | 1672 return renderer_scheduler_.get(); |
1673 } | 1673 } |
1674 | 1674 |
1675 cc::ContextProvider* RenderThreadImpl::GetSharedMainThreadContextProvider() { | 1675 cc::ContextProvider* RenderThreadImpl::GetSharedMainThreadContextProvider() { |
1676 return SharedMainThreadContextProvider().get(); | 1676 return SharedMainThreadContextProvider().get(); |
1677 } | 1677 } |
1678 | 1678 |
1679 scoped_ptr<cc::BeginFrameSource> | 1679 std::unique_ptr<cc::BeginFrameSource> |
1680 RenderThreadImpl::CreateExternalBeginFrameSource(int routing_id) { | 1680 RenderThreadImpl::CreateExternalBeginFrameSource(int routing_id) { |
1681 #if defined(OS_ANDROID) | 1681 #if defined(OS_ANDROID) |
1682 if (SynchronousCompositorFactory* factory = | 1682 if (SynchronousCompositorFactory* factory = |
1683 SynchronousCompositorFactory::GetInstance()) { | 1683 SynchronousCompositorFactory::GetInstance()) { |
1684 DCHECK(!sync_compositor_message_filter_); | 1684 DCHECK(!sync_compositor_message_filter_); |
1685 return factory->CreateExternalBeginFrameSource(routing_id); | 1685 return factory->CreateExternalBeginFrameSource(routing_id); |
1686 } else if (sync_compositor_message_filter_) { | 1686 } else if (sync_compositor_message_filter_) { |
1687 return make_scoped_ptr(new SynchronousCompositorExternalBeginFrameSource( | 1687 return base::WrapUnique(new SynchronousCompositorExternalBeginFrameSource( |
1688 routing_id, sync_compositor_message_filter_.get())); | 1688 routing_id, sync_compositor_message_filter_.get())); |
1689 } | 1689 } |
1690 #endif | 1690 #endif |
1691 return make_scoped_ptr(new CompositorExternalBeginFrameSource( | 1691 return base::WrapUnique(new CompositorExternalBeginFrameSource( |
1692 compositor_message_filter_.get(), sync_message_filter(), routing_id)); | 1692 compositor_message_filter_.get(), sync_message_filter(), routing_id)); |
1693 } | 1693 } |
1694 | 1694 |
1695 cc::ImageSerializationProcessor* | 1695 cc::ImageSerializationProcessor* |
1696 RenderThreadImpl::GetImageSerializationProcessor() { | 1696 RenderThreadImpl::GetImageSerializationProcessor() { |
1697 return GetContentClient()->renderer()->GetImageSerializationProcessor(); | 1697 return GetContentClient()->renderer()->GetImageSerializationProcessor(); |
1698 } | 1698 } |
1699 | 1699 |
1700 cc::TaskGraphRunner* RenderThreadImpl::GetTaskGraphRunner() { | 1700 cc::TaskGraphRunner* RenderThreadImpl::GetTaskGraphRunner() { |
1701 return raster_worker_pool_->GetTaskGraphRunner(); | 1701 return raster_worker_pool_->GetTaskGraphRunner(); |
1702 } | 1702 } |
1703 | 1703 |
1704 bool RenderThreadImpl::AreImageDecodeTasksEnabled() { | 1704 bool RenderThreadImpl::AreImageDecodeTasksEnabled() { |
1705 return are_image_decode_tasks_enabled_; | 1705 return are_image_decode_tasks_enabled_; |
1706 } | 1706 } |
1707 | 1707 |
1708 bool RenderThreadImpl::IsThreadedAnimationEnabled() { | 1708 bool RenderThreadImpl::IsThreadedAnimationEnabled() { |
1709 return is_threaded_animation_enabled_; | 1709 return is_threaded_animation_enabled_; |
1710 } | 1710 } |
1711 | 1711 |
1712 bool RenderThreadImpl::IsMainThread() { | 1712 bool RenderThreadImpl::IsMainThread() { |
1713 return !!current(); | 1713 return !!current(); |
1714 } | 1714 } |
1715 | 1715 |
1716 scoped_refptr<base::SingleThreadTaskRunner> | 1716 scoped_refptr<base::SingleThreadTaskRunner> |
1717 RenderThreadImpl::GetIOThreadTaskRunner() { | 1717 RenderThreadImpl::GetIOThreadTaskRunner() { |
1718 return io_thread_task_runner_; | 1718 return io_thread_task_runner_; |
1719 } | 1719 } |
1720 | 1720 |
1721 scoped_ptr<base::SharedMemory> RenderThreadImpl::AllocateSharedMemory( | 1721 std::unique_ptr<base::SharedMemory> RenderThreadImpl::AllocateSharedMemory( |
1722 size_t size) { | 1722 size_t size) { |
1723 return HostAllocateSharedMemoryBuffer(size); | 1723 return HostAllocateSharedMemoryBuffer(size); |
1724 } | 1724 } |
1725 | 1725 |
1726 void RenderThreadImpl::DoNotNotifyWebKitOfModalLoop() { | 1726 void RenderThreadImpl::DoNotNotifyWebKitOfModalLoop() { |
1727 notify_webkit_of_modal_loop_ = false; | 1727 notify_webkit_of_modal_loop_ = false; |
1728 } | 1728 } |
1729 | 1729 |
1730 bool RenderThreadImpl::OnControlMessageReceived(const IPC::Message& msg) { | 1730 bool RenderThreadImpl::OnControlMessageReceived(const IPC::Message& msg) { |
1731 base::ObserverListBase<RenderProcessObserver>::Iterator it(&observers_); | 1731 base::ObserverListBase<RenderProcessObserver>::Iterator it(&observers_); |
(...skipping 131 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1863 return gpu_channel_.get(); | 1863 return gpu_channel_.get(); |
1864 } | 1864 } |
1865 | 1865 |
1866 blink::WebMediaStreamCenter* RenderThreadImpl::CreateMediaStreamCenter( | 1866 blink::WebMediaStreamCenter* RenderThreadImpl::CreateMediaStreamCenter( |
1867 blink::WebMediaStreamCenterClient* client) { | 1867 blink::WebMediaStreamCenterClient* client) { |
1868 #if defined(ENABLE_WEBRTC) | 1868 #if defined(ENABLE_WEBRTC) |
1869 if (!media_stream_center_) { | 1869 if (!media_stream_center_) { |
1870 media_stream_center_ = GetContentClient()->renderer() | 1870 media_stream_center_ = GetContentClient()->renderer() |
1871 ->OverrideCreateWebMediaStreamCenter(client); | 1871 ->OverrideCreateWebMediaStreamCenter(client); |
1872 if (!media_stream_center_) { | 1872 if (!media_stream_center_) { |
1873 scoped_ptr<MediaStreamCenter> media_stream_center( | 1873 std::unique_ptr<MediaStreamCenter> media_stream_center( |
1874 new MediaStreamCenter(client, GetPeerConnectionDependencyFactory())); | 1874 new MediaStreamCenter(client, GetPeerConnectionDependencyFactory())); |
1875 media_stream_center_ = media_stream_center.release(); | 1875 media_stream_center_ = media_stream_center.release(); |
1876 } | 1876 } |
1877 } | 1877 } |
1878 #endif | 1878 #endif |
1879 return media_stream_center_; | 1879 return media_stream_center_; |
1880 } | 1880 } |
1881 | 1881 |
1882 #if defined(ENABLE_WEBRTC) | 1882 #if defined(ENABLE_WEBRTC) |
1883 PeerConnectionDependencyFactory* | 1883 PeerConnectionDependencyFactory* |
(...skipping 261 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2145 } | 2145 } |
2146 | 2146 |
2147 void RenderThreadImpl::PendingRenderFrameConnect::OnConnectionError() { | 2147 void RenderThreadImpl::PendingRenderFrameConnect::OnConnectionError() { |
2148 size_t erased = | 2148 size_t erased = |
2149 RenderThreadImpl::current()->pending_render_frame_connects_.erase( | 2149 RenderThreadImpl::current()->pending_render_frame_connects_.erase( |
2150 routing_id_); | 2150 routing_id_); |
2151 DCHECK_EQ(1u, erased); | 2151 DCHECK_EQ(1u, erased); |
2152 } | 2152 } |
2153 | 2153 |
2154 } // namespace content | 2154 } // namespace content |
OLD | NEW |