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 // Represents the browser side of the browser <--> renderer communication | 5 // Represents the browser side of the browser <--> renderer communication |
6 // channel. There will be one RenderProcessHost per renderer process. | 6 // channel. There will be one RenderProcessHost per renderer process. |
7 | 7 |
8 #include "content/browser/renderer_host/render_process_host_impl.h" | 8 #include "content/browser/renderer_host/render_process_host_impl.h" |
9 | 9 |
10 #if defined(OS_WIN) | 10 #if defined(OS_WIN) |
(...skipping 336 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
347 widget_helper_ = new RenderWidgetHelper(); | 347 widget_helper_ = new RenderWidgetHelper(); |
348 | 348 |
349 ChildProcessSecurityPolicyImpl::GetInstance()->Add(GetID()); | 349 ChildProcessSecurityPolicyImpl::GetInstance()->Add(GetID()); |
350 | 350 |
351 // Grant most file permissions to this renderer. | 351 // Grant most file permissions to this renderer. |
352 // PLATFORM_FILE_TEMPORARY, PLATFORM_FILE_HIDDEN and | 352 // PLATFORM_FILE_TEMPORARY, PLATFORM_FILE_HIDDEN and |
353 // PLATFORM_FILE_DELETE_ON_CLOSE are not granted, because no existing API | 353 // PLATFORM_FILE_DELETE_ON_CLOSE are not granted, because no existing API |
354 // requests them. | 354 // requests them. |
355 // This is for the filesystem sandbox. | 355 // This is for the filesystem sandbox. |
356 ChildProcessSecurityPolicyImpl::GetInstance()->GrantPermissionsForFile( | 356 ChildProcessSecurityPolicyImpl::GetInstance()->GrantPermissionsForFile( |
357 GetID(), browser_context->GetPath().Append( | 357 GetID(), storage_partition_impl->GetPath().Append( |
358 fileapi::SandboxMountPointProvider::kNewFileSystemDirectory), | 358 fileapi::SandboxMountPointProvider::kNewFileSystemDirectory), |
359 base::PLATFORM_FILE_OPEN | | 359 base::PLATFORM_FILE_OPEN | |
360 base::PLATFORM_FILE_CREATE | | 360 base::PLATFORM_FILE_CREATE | |
361 base::PLATFORM_FILE_OPEN_ALWAYS | | 361 base::PLATFORM_FILE_OPEN_ALWAYS | |
362 base::PLATFORM_FILE_CREATE_ALWAYS | | 362 base::PLATFORM_FILE_CREATE_ALWAYS | |
363 base::PLATFORM_FILE_OPEN_TRUNCATED | | 363 base::PLATFORM_FILE_OPEN_TRUNCATED | |
364 base::PLATFORM_FILE_READ | | 364 base::PLATFORM_FILE_READ | |
365 base::PLATFORM_FILE_WRITE | | 365 base::PLATFORM_FILE_WRITE | |
366 base::PLATFORM_FILE_EXCLUSIVE_READ | | 366 base::PLATFORM_FILE_EXCLUSIVE_READ | |
367 base::PLATFORM_FILE_EXCLUSIVE_WRITE | | 367 base::PLATFORM_FILE_EXCLUSIVE_WRITE | |
368 base::PLATFORM_FILE_ASYNC | | 368 base::PLATFORM_FILE_ASYNC | |
369 base::PLATFORM_FILE_WRITE_ATTRIBUTES | | 369 base::PLATFORM_FILE_WRITE_ATTRIBUTES | |
370 base::PLATFORM_FILE_ENUMERATE); | 370 base::PLATFORM_FILE_ENUMERATE); |
371 // This is so that we can read and move stuff out of the old filesystem | 371 // This is so that we can read and move stuff out of the old filesystem |
372 // sandbox. | 372 // sandbox. |
373 ChildProcessSecurityPolicyImpl::GetInstance()->GrantPermissionsForFile( | 373 ChildProcessSecurityPolicyImpl::GetInstance()->GrantPermissionsForFile( |
374 GetID(), browser_context->GetPath().Append( | 374 GetID(), storage_partition_impl_->GetPath().Append( |
375 fileapi::SandboxMountPointProvider::kOldFileSystemDirectory), | 375 fileapi::SandboxMountPointProvider::kOldFileSystemDirectory), |
376 base::PLATFORM_FILE_READ | base::PLATFORM_FILE_WRITE | | 376 base::PLATFORM_FILE_READ | base::PLATFORM_FILE_WRITE | |
377 base::PLATFORM_FILE_WRITE_ATTRIBUTES | base::PLATFORM_FILE_ENUMERATE); | 377 base::PLATFORM_FILE_WRITE_ATTRIBUTES | base::PLATFORM_FILE_ENUMERATE); |
378 // This is so that we can rename the old sandbox out of the way so that we | 378 // This is so that we can rename the old sandbox out of the way so that we |
379 // know we've taken care of it. | 379 // know we've taken care of it. |
380 ChildProcessSecurityPolicyImpl::GetInstance()->GrantPermissionsForFile( | 380 ChildProcessSecurityPolicyImpl::GetInstance()->GrantPermissionsForFile( |
381 GetID(), browser_context->GetPath().Append( | 381 GetID(), storage_partition_impl_->GetPath().Append( |
382 fileapi::SandboxMountPointProvider::kRenamedOldFileSystemDirectory), | 382 fileapi::SandboxMountPointProvider::kRenamedOldFileSystemDirectory), |
383 base::PLATFORM_FILE_CREATE | base::PLATFORM_FILE_CREATE_ALWAYS | | 383 base::PLATFORM_FILE_CREATE | base::PLATFORM_FILE_CREATE_ALWAYS | |
384 base::PLATFORM_FILE_WRITE); | 384 base::PLATFORM_FILE_WRITE); |
385 | 385 |
386 CHECK(!g_exited_main_message_loop); | 386 CHECK(!g_exited_main_message_loop); |
387 RegisterHost(GetID(), this); | 387 RegisterHost(GetID(), this); |
388 g_all_hosts.Get().set_check_on_null_data(true); | 388 g_all_hosts.Get().set_check_on_null_data(true); |
389 // Initialize |child_process_activity_time_| to a reasonable value. | 389 // Initialize |child_process_activity_time_| to a reasonable value. |
390 mark_child_process_activity_time(); | 390 mark_child_process_activity_time(); |
391 // Note: When we create the RenderProcessHostImpl, it's technically | 391 // Note: When we create the RenderProcessHostImpl, it's technically |
(...skipping 163 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
555 storage_partition_impl_->GetIndexedDBContext())); | 555 storage_partition_impl_->GetIndexedDBContext())); |
556 channel_->AddFilter(GeolocationDispatcherHost::New( | 556 channel_->AddFilter(GeolocationDispatcherHost::New( |
557 GetID(), browser_context->GetGeolocationPermissionContext())); | 557 GetID(), browser_context->GetGeolocationPermissionContext())); |
558 gpu_message_filter_ = new GpuMessageFilter(GetID(), widget_helper_.get()); | 558 gpu_message_filter_ = new GpuMessageFilter(GetID(), widget_helper_.get()); |
559 channel_->AddFilter(gpu_message_filter_); | 559 channel_->AddFilter(gpu_message_filter_); |
560 #if defined(ENABLE_WEBRTC) | 560 #if defined(ENABLE_WEBRTC) |
561 channel_->AddFilter(new media_stream::MediaStreamDispatcherHost(GetID())); | 561 channel_->AddFilter(new media_stream::MediaStreamDispatcherHost(GetID())); |
562 #endif | 562 #endif |
563 channel_->AddFilter( | 563 channel_->AddFilter( |
564 GetContentClient()->browser()->AllowPepperPrivateFileAPI() ? | 564 GetContentClient()->browser()->AllowPepperPrivateFileAPI() ? |
565 new PepperUnsafeFileMessageFilter(GetID(), browser_context->GetPath()) : | 565 new PepperUnsafeFileMessageFilter( |
566 new PepperFileMessageFilter(GetID())); | 566 GetID(), |
| 567 storage_partition_impl_->GetPath()) : |
| 568 new PepperFileMessageFilter(GetID())); |
567 channel_->AddFilter(new PepperMessageFilter(PepperMessageFilter::RENDERER, | 569 channel_->AddFilter(new PepperMessageFilter(PepperMessageFilter::RENDERER, |
568 GetID(), browser_context)); | 570 GetID(), browser_context)); |
569 #if defined(ENABLE_INPUT_SPEECH) | 571 #if defined(ENABLE_INPUT_SPEECH) |
570 channel_->AddFilter(new speech::InputTagSpeechDispatcherHost( | 572 channel_->AddFilter(new speech::InputTagSpeechDispatcherHost( |
571 GetID(), browser_context->GetRequestContext(), | 573 GetID(), storage_partition_impl_->GetURLRequestContext(), |
572 browser_context->GetSpeechRecognitionPreferences())); | 574 browser_context->GetSpeechRecognitionPreferences())); |
573 channel_->AddFilter(new speech::SpeechRecognitionDispatcherHost( | 575 channel_->AddFilter(new speech::SpeechRecognitionDispatcherHost( |
574 GetID(), browser_context->GetRequestContext(), | 576 GetID(), storage_partition_impl_->GetURLRequestContext(), |
575 browser_context->GetSpeechRecognitionPreferences())); | 577 browser_context->GetSpeechRecognitionPreferences())); |
576 #endif | 578 #endif |
577 channel_->AddFilter(new FileAPIMessageFilter( | 579 channel_->AddFilter(new FileAPIMessageFilter( |
578 GetID(), | 580 GetID(), |
579 browser_context->GetRequestContext(), | 581 storage_partition_impl_->GetURLRequestContext(), |
580 BrowserContext::GetFileSystemContext(browser_context), | 582 storage_partition_impl_->GetFileSystemContext(), |
581 ChromeBlobStorageContext::GetFor(browser_context))); | 583 ChromeBlobStorageContext::GetFor(browser_context))); |
582 channel_->AddFilter(new OrientationMessageFilter()); | 584 channel_->AddFilter(new OrientationMessageFilter()); |
583 channel_->AddFilter(new FileUtilitiesMessageFilter(GetID())); | 585 channel_->AddFilter(new FileUtilitiesMessageFilter(GetID())); |
584 channel_->AddFilter(new MimeRegistryMessageFilter()); | 586 channel_->AddFilter(new MimeRegistryMessageFilter()); |
585 channel_->AddFilter(new DatabaseMessageFilter( | 587 channel_->AddFilter(new DatabaseMessageFilter( |
586 storage_partition_impl_->GetDatabaseTracker())); | 588 storage_partition_impl_->GetDatabaseTracker())); |
587 #if defined(OS_MACOSX) | 589 #if defined(OS_MACOSX) |
588 channel_->AddFilter(new TextInputClientMessageFilter(GetID())); | 590 channel_->AddFilter(new TextInputClientMessageFilter(GetID())); |
589 #elif defined(OS_WIN) | 591 #elif defined(OS_WIN) |
590 channel_->AddFilter(new FontCacheDispatcher()); | 592 channel_->AddFilter(new FontCacheDispatcher()); |
591 #endif | 593 #endif |
592 | 594 |
593 SocketStreamDispatcherHost* socket_stream_dispatcher_host = | 595 SocketStreamDispatcherHost* socket_stream_dispatcher_host = |
594 new SocketStreamDispatcherHost(GetID(), | 596 new SocketStreamDispatcherHost(GetID(), |
595 new RendererURLRequestContextSelector(browser_context, GetID()), | 597 new RendererURLRequestContextSelector(browser_context, GetID()), |
596 resource_context); | 598 resource_context); |
597 channel_->AddFilter(socket_stream_dispatcher_host); | 599 channel_->AddFilter(socket_stream_dispatcher_host); |
598 | 600 |
599 channel_->AddFilter( | 601 channel_->AddFilter( |
600 new WorkerMessageFilter( | 602 new WorkerMessageFilter( |
601 GetID(), | 603 GetID(), |
602 resource_context, | 604 resource_context, |
603 WorkerStoragePartition( | 605 WorkerStoragePartition( |
| 606 storage_partition_impl_->GetURLRequestContext(), |
| 607 storage_partition_impl_->GetMediaURLRequestContext(), |
604 storage_partition_impl_->GetAppCacheService(), | 608 storage_partition_impl_->GetAppCacheService(), |
605 storage_partition_impl_->GetFileSystemContext(), | 609 storage_partition_impl_->GetFileSystemContext(), |
606 storage_partition_impl_->GetDatabaseTracker(), | 610 storage_partition_impl_->GetDatabaseTracker(), |
607 storage_partition_impl_->GetIndexedDBContext()), | 611 storage_partition_impl_->GetIndexedDBContext()), |
608 base::Bind(&RenderWidgetHelper::GetNextRoutingID, | 612 base::Bind(&RenderWidgetHelper::GetNextRoutingID, |
609 base::Unretained(widget_helper_.get())))); | 613 base::Unretained(widget_helper_.get())))); |
610 | 614 |
611 #if defined(ENABLE_WEBRTC) | 615 #if defined(ENABLE_WEBRTC) |
612 channel_->AddFilter(new P2PSocketDispatcherHost(resource_context)); | 616 channel_->AddFilter(new P2PSocketDispatcherHost(resource_context)); |
613 #endif | 617 #endif |
(...skipping 931 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1545 const gfx::Size& size, | 1549 const gfx::Size& size, |
1546 int32 gpu_process_host_id) { | 1550 int32 gpu_process_host_id) { |
1547 TRACE_EVENT0("renderer_host", | 1551 TRACE_EVENT0("renderer_host", |
1548 "RenderWidgetHostImpl::OnCompositorSurfaceBuffersSwappedNoHost"); | 1552 "RenderWidgetHostImpl::OnCompositorSurfaceBuffersSwappedNoHost"); |
1549 RenderWidgetHostImpl::AcknowledgeBufferPresent(route_id, | 1553 RenderWidgetHostImpl::AcknowledgeBufferPresent(route_id, |
1550 gpu_process_host_id, | 1554 gpu_process_host_id, |
1551 0); | 1555 0); |
1552 } | 1556 } |
1553 | 1557 |
1554 } // namespace content | 1558 } // namespace content |
OLD | NEW |