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 162 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
554 BrowserContext::GetIndexedDBContext(browser_context)))); | 554 BrowserContext::GetIndexedDBContext(browser_context)))); |
555 channel_->AddFilter(GeolocationDispatcherHost::New( | 555 channel_->AddFilter(GeolocationDispatcherHost::New( |
556 GetID(), browser_context->GetGeolocationPermissionContext())); | 556 GetID(), browser_context->GetGeolocationPermissionContext())); |
557 gpu_message_filter_ = new GpuMessageFilter(GetID(), widget_helper_.get()); | 557 gpu_message_filter_ = new GpuMessageFilter(GetID(), widget_helper_.get()); |
558 channel_->AddFilter(gpu_message_filter_); | 558 channel_->AddFilter(gpu_message_filter_); |
559 #if defined(ENABLE_WEBRTC) | 559 #if defined(ENABLE_WEBRTC) |
560 channel_->AddFilter(new media_stream::MediaStreamDispatcherHost(GetID())); | 560 channel_->AddFilter(new media_stream::MediaStreamDispatcherHost(GetID())); |
561 #endif | 561 #endif |
562 channel_->AddFilter( | 562 channel_->AddFilter( |
563 GetContentClient()->browser()->AllowPepperPrivateFileAPI() ? | 563 GetContentClient()->browser()->AllowPepperPrivateFileAPI() ? |
564 new PepperUnsafeFileMessageFilter(GetID(), browser_context->GetPath()) : | 564 new PepperUnsafeFileMessageFilter(GetID(), |
565 new PepperFileMessageFilter(GetID())); | 565 storage_partition_impl_->GetPath()) : |
michaeln
2012/09/15 01:48:33
line length
awong
2012/09/15 02:05:02
Done.
| |
566 new PepperFileMessageFilter(GetID())); | |
566 channel_->AddFilter(new PepperMessageFilter(PepperMessageFilter::RENDERER, | 567 channel_->AddFilter(new PepperMessageFilter(PepperMessageFilter::RENDERER, |
567 GetID(), browser_context)); | 568 GetID(), browser_context)); |
568 #if defined(ENABLE_INPUT_SPEECH) | 569 #if defined(ENABLE_INPUT_SPEECH) |
569 channel_->AddFilter(new speech::InputTagSpeechDispatcherHost( | 570 channel_->AddFilter(new speech::InputTagSpeechDispatcherHost( |
570 GetID(), browser_context->GetRequestContext(), | 571 GetID(), storage_partition_impl_->GetURLRequestContext(), |
571 browser_context->GetSpeechRecognitionPreferences())); | 572 browser_context->GetSpeechRecognitionPreferences())); |
572 channel_->AddFilter(new speech::SpeechRecognitionDispatcherHost( | 573 channel_->AddFilter(new speech::SpeechRecognitionDispatcherHost( |
573 GetID(), browser_context->GetRequestContext(), | 574 GetID(), storage_partition_impl_->GetURLRequestContext(), |
574 browser_context->GetSpeechRecognitionPreferences())); | 575 browser_context->GetSpeechRecognitionPreferences())); |
575 #endif | 576 #endif |
576 channel_->AddFilter(new FileAPIMessageFilter( | 577 channel_->AddFilter(new FileAPIMessageFilter( |
577 GetID(), | 578 GetID(), |
578 browser_context->GetRequestContext(), | 579 storage_partition_impl_->GetURLRequestContext(), |
579 BrowserContext::GetFileSystemContext(browser_context), | 580 storage_partition_impl_->GetFileSystemContext(), |
580 ChromeBlobStorageContext::GetFor(browser_context))); | 581 ChromeBlobStorageContext::GetFor(browser_context))); |
581 channel_->AddFilter(new OrientationMessageFilter()); | 582 channel_->AddFilter(new OrientationMessageFilter()); |
582 channel_->AddFilter(new FileUtilitiesMessageFilter(GetID())); | 583 channel_->AddFilter(new FileUtilitiesMessageFilter(GetID())); |
583 channel_->AddFilter(new MimeRegistryMessageFilter()); | 584 channel_->AddFilter(new MimeRegistryMessageFilter()); |
584 channel_->AddFilter(new DatabaseMessageFilter( | 585 channel_->AddFilter(new DatabaseMessageFilter( |
585 storage_partition_impl_->GetDatabaseTracker())); | 586 storage_partition_impl_->GetDatabaseTracker())); |
586 #if defined(OS_MACOSX) | 587 #if defined(OS_MACOSX) |
587 channel_->AddFilter(new TextInputClientMessageFilter(GetID())); | 588 channel_->AddFilter(new TextInputClientMessageFilter(GetID())); |
588 #elif defined(OS_WIN) | 589 #elif defined(OS_WIN) |
589 channel_->AddFilter(new FontCacheDispatcher()); | 590 channel_->AddFilter(new FontCacheDispatcher()); |
590 #endif | 591 #endif |
591 | 592 |
592 SocketStreamDispatcherHost* socket_stream_dispatcher_host = | 593 SocketStreamDispatcherHost* socket_stream_dispatcher_host = |
593 new SocketStreamDispatcherHost(GetID(), | 594 new SocketStreamDispatcherHost(GetID(), |
594 new RendererURLRequestContextSelector(browser_context, GetID()), | 595 new RendererURLRequestContextSelector(browser_context, GetID()), |
595 resource_context); | 596 resource_context); |
596 channel_->AddFilter(socket_stream_dispatcher_host); | 597 channel_->AddFilter(socket_stream_dispatcher_host); |
597 | 598 |
598 channel_->AddFilter( | 599 channel_->AddFilter( |
599 new WorkerMessageFilter( | 600 new WorkerMessageFilter( |
600 GetID(), | 601 GetID(), |
601 resource_context, | 602 resource_context, |
602 WorkerStoragePartition( | 603 WorkerStoragePartition( |
604 storage_partition_impl_->GetURLRequestContext(), | |
605 storage_partition_impl_->GetMediaURLRequestContext(), | |
603 storage_partition_impl_->GetAppCacheService(), | 606 storage_partition_impl_->GetAppCacheService(), |
604 storage_partition_impl_->GetFileSystemContext(), | 607 storage_partition_impl_->GetFileSystemContext(), |
605 storage_partition_impl_->GetDatabaseTracker(), | 608 storage_partition_impl_->GetDatabaseTracker(), |
606 storage_partition_impl_->GetIndexedDBContext()), | 609 storage_partition_impl_->GetIndexedDBContext()), |
607 base::Bind(&RenderWidgetHelper::GetNextRoutingID, | 610 base::Bind(&RenderWidgetHelper::GetNextRoutingID, |
608 base::Unretained(widget_helper_.get())))); | 611 base::Unretained(widget_helper_.get())))); |
609 | 612 |
610 #if defined(ENABLE_WEBRTC) | 613 #if defined(ENABLE_WEBRTC) |
611 channel_->AddFilter(new P2PSocketDispatcherHost(resource_context)); | 614 channel_->AddFilter(new P2PSocketDispatcherHost(resource_context)); |
612 #endif | 615 #endif |
(...skipping 933 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1546 const gfx::Size& size, | 1549 const gfx::Size& size, |
1547 int32 gpu_process_host_id) { | 1550 int32 gpu_process_host_id) { |
1548 TRACE_EVENT0("renderer_host", | 1551 TRACE_EVENT0("renderer_host", |
1549 "RenderWidgetHostImpl::OnCompositorSurfaceBuffersSwappedNoHost"); | 1552 "RenderWidgetHostImpl::OnCompositorSurfaceBuffersSwappedNoHost"); |
1550 RenderWidgetHostImpl::AcknowledgeBufferPresent(route_id, | 1553 RenderWidgetHostImpl::AcknowledgeBufferPresent(route_id, |
1551 gpu_process_host_id, | 1554 gpu_process_host_id, |
1552 0); | 1555 0); |
1553 } | 1556 } |
1554 | 1557 |
1555 } // namespace content | 1558 } // namespace content |
OLD | NEW |