| 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 #ifndef CONTENT_BROWSER_RENDERER_HOST_RENDER_PROCESS_HOST_IMPL_H_ | 5 #ifndef CONTENT_BROWSER_RENDERER_HOST_RENDER_PROCESS_HOST_IMPL_H_ |
| 6 #define CONTENT_BROWSER_RENDERER_HOST_RENDER_PROCESS_HOST_IMPL_H_ | 6 #define CONTENT_BROWSER_RENDERER_HOST_RENDER_PROCESS_HOST_IMPL_H_ |
| 7 | 7 |
| 8 #include <stddef.h> | 8 #include <stddef.h> |
| 9 #include <stdint.h> | 9 #include <stdint.h> |
| 10 | 10 |
| (...skipping 118 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 129 int GetID() const override; | 129 int GetID() const override; |
| 130 bool HasConnection() const override; | 130 bool HasConnection() const override; |
| 131 void SetIgnoreInputEvents(bool ignore_input_events) override; | 131 void SetIgnoreInputEvents(bool ignore_input_events) override; |
| 132 bool IgnoreInputEvents() const override; | 132 bool IgnoreInputEvents() const override; |
| 133 void Cleanup() override; | 133 void Cleanup() override; |
| 134 void AddPendingView() override; | 134 void AddPendingView() override; |
| 135 void RemovePendingView() override; | 135 void RemovePendingView() override; |
| 136 void SetSuddenTerminationAllowed(bool enabled) override; | 136 void SetSuddenTerminationAllowed(bool enabled) override; |
| 137 bool SuddenTerminationAllowed() const override; | 137 bool SuddenTerminationAllowed() const override; |
| 138 IPC::ChannelProxy* GetChannel() override; | 138 IPC::ChannelProxy* GetChannel() override; |
| 139 IPC::Sender* GetImmediateSender() override; | |
| 140 IPC::Sender* GetIOThreadSender() override; | |
| 141 void AddFilter(BrowserMessageFilter* filter) override; | 139 void AddFilter(BrowserMessageFilter* filter) override; |
| 142 bool FastShutdownForPageCount(size_t count) override; | 140 bool FastShutdownForPageCount(size_t count) override; |
| 143 bool FastShutdownStarted() const override; | 141 bool FastShutdownStarted() const override; |
| 144 base::TimeDelta GetChildProcessIdleTime() const override; | 142 base::TimeDelta GetChildProcessIdleTime() const override; |
| 145 void FilterURL(bool empty_allowed, GURL* url) override; | 143 void FilterURL(bool empty_allowed, GURL* url) override; |
| 146 #if defined(ENABLE_WEBRTC) | 144 #if defined(ENABLE_WEBRTC) |
| 147 void EnableAudioDebugRecordings(const base::FilePath& file) override; | 145 void EnableAudioDebugRecordings(const base::FilePath& file) override; |
| 148 void DisableAudioDebugRecordings() override; | 146 void DisableAudioDebugRecordings() override; |
| 149 void EnableEventLogRecordings(const base::FilePath& file) override; | 147 void EnableEventLogRecordings(const base::FilePath& file) override; |
| 150 void DisableEventLogRecordings() override; | 148 void DisableEventLogRecordings() override; |
| (...skipping 136 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 287 // True if this object has deleted itself. | 285 // True if this object has deleted itself. |
| 288 bool is_self_deleted_; | 286 bool is_self_deleted_; |
| 289 #endif | 287 #endif |
| 290 | 288 |
| 291 // The count of currently swapped out but pending RenderViews. We have | 289 // The count of currently swapped out but pending RenderViews. We have |
| 292 // started to swap these in, so the renderer process should not exit if | 290 // started to swap these in, so the renderer process should not exit if |
| 293 // this count is non-zero. | 291 // this count is non-zero. |
| 294 int32_t pending_views_; | 292 int32_t pending_views_; |
| 295 | 293 |
| 296 private: | 294 private: |
| 297 class SafeSenderProxy; | |
| 298 | |
| 299 friend class ChildProcessLauncherBrowserTest_ChildSpawnFail_Test; | 295 friend class ChildProcessLauncherBrowserTest_ChildSpawnFail_Test; |
| 300 friend class SafeSenderProxy; | |
| 301 friend class VisitRelayingRenderProcessHost; | 296 friend class VisitRelayingRenderProcessHost; |
| 302 | 297 |
| 303 std::unique_ptr<IPC::ChannelProxy> CreateChannelProxy( | 298 std::unique_ptr<IPC::ChannelProxy> CreateChannelProxy( |
| 304 const std::string& channel_id); | 299 const std::string& channel_id); |
| 305 | 300 |
| 306 // Creates and adds the IO thread message filters. | 301 // Creates and adds the IO thread message filters. |
| 307 void CreateMessageFilters(); | 302 void CreateMessageFilters(); |
| 308 | 303 |
| 309 // Shared implementation for IPC::Senders exposed by this RPH. | |
| 310 bool SendImpl(std::unique_ptr<IPC::Message> message, bool send_now); | |
| 311 | |
| 312 // Registers Mojo services to be exposed to the renderer. | 304 // Registers Mojo services to be exposed to the renderer. |
| 313 void RegisterMojoServices(); | 305 void RegisterMojoServices(); |
| 314 | 306 |
| 315 void CreateStoragePartitionService( | 307 void CreateStoragePartitionService( |
| 316 mojo::InterfaceRequest<mojom::StoragePartitionService> request); | 308 mojo::InterfaceRequest<mojom::StoragePartitionService> request); |
| 317 | 309 |
| 318 // Control message handlers. | 310 // Control message handlers. |
| 319 void OnShutdownRequest(); | 311 void OnShutdownRequest(); |
| 320 void SuddenTerminationChanged(bool enabled); | 312 void SuddenTerminationChanged(bool enabled); |
| 321 void OnUserMetricsRecordAction(const std::string& action); | 313 void OnUserMetricsRecordAction(const std::string& action); |
| (...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 369 void SendDisableEventLogToRenderer(); | 361 void SendDisableEventLogToRenderer(); |
| 370 base::FilePath GetAecDumpFilePathWithExtensions(const base::FilePath& file); | 362 base::FilePath GetAecDumpFilePathWithExtensions(const base::FilePath& file); |
| 371 base::FilePath GetEventLogFilePathWithExtensions(const base::FilePath& file); | 363 base::FilePath GetEventLogFilePathWithExtensions(const base::FilePath& file); |
| 372 #endif | 364 #endif |
| 373 | 365 |
| 374 static void OnMojoError( | 366 static void OnMojoError( |
| 375 base::WeakPtr<RenderProcessHostImpl> process, | 367 base::WeakPtr<RenderProcessHostImpl> process, |
| 376 scoped_refptr<base::SingleThreadTaskRunner> task_runner, | 368 scoped_refptr<base::SingleThreadTaskRunner> task_runner, |
| 377 const std::string& error); | 369 const std::string& error); |
| 378 | 370 |
| 379 // IPC::Senders which live as long as this RPH and provide safe, opaque | 371 std::string child_token_; |
| 380 // access to ChannelProxy SendNow() and SendOnIOThread() respectively. | |
| 381 const std::unique_ptr<SafeSenderProxy> immediate_sender_; | |
| 382 const std::unique_ptr<SafeSenderProxy> io_thread_sender_; | |
| 383 | 372 |
| 384 std::string child_token_; | |
| 385 std::unique_ptr<MojoChildConnection> mojo_child_connection_; | 373 std::unique_ptr<MojoChildConnection> mojo_child_connection_; |
| 386 std::unique_ptr<MojoApplicationHost> mojo_application_host_; | 374 std::unique_ptr<MojoApplicationHost> mojo_application_host_; |
| 387 | 375 |
| 388 // The registered IPC listener objects. When this list is empty, we should | 376 // The registered IPC listener objects. When this list is empty, we should |
| 389 // delete ourselves. | 377 // delete ourselves. |
| 390 IDMap<IPC::Listener> listeners_; | 378 IDMap<IPC::Listener> listeners_; |
| 391 | 379 |
| 392 // The count of currently visible widgets. Since the host can be a container | 380 // The count of currently visible widgets. Since the host can be a container |
| 393 // for multiple widgets, it uses this count to determine when it should be | 381 // for multiple widgets, it uses this count to determine when it should be |
| 394 // backgrounded. | 382 // backgrounded. |
| (...skipping 25 matching lines...) Expand all Loading... |
| 420 // Stores the time at which the first call to Init happened. | 408 // Stores the time at which the first call to Init happened. |
| 421 base::TimeTicks init_time_; | 409 base::TimeTicks init_time_; |
| 422 | 410 |
| 423 // Used to launch and terminate the process without blocking the UI thread. | 411 // Used to launch and terminate the process without blocking the UI thread. |
| 424 std::unique_ptr<ChildProcessLauncher> child_process_launcher_; | 412 std::unique_ptr<ChildProcessLauncher> child_process_launcher_; |
| 425 | 413 |
| 426 // Messages we queue while waiting for the process handle. We queue them here | 414 // Messages we queue while waiting for the process handle. We queue them here |
| 427 // instead of in the channel so that we ensure they're sent after init related | 415 // instead of in the channel so that we ensure they're sent after init related |
| 428 // messages that are sent once the process handle is available. This is | 416 // messages that are sent once the process handle is available. This is |
| 429 // because the queued messages may have dependencies on the init messages. | 417 // because the queued messages may have dependencies on the init messages. |
| 430 std::queue<std::unique_ptr<IPC::Message>> queued_messages_; | 418 std::queue<IPC::Message*> queued_messages_; |
| 431 | 419 |
| 432 // The globally-unique identifier for this RPH. | 420 // The globally-unique identifier for this RPH. |
| 433 const int id_; | 421 const int id_; |
| 434 | 422 |
| 435 // A secondary ID used by the Mojo shell to distinguish different incarnations | 423 // A secondary ID used by the Mojo shell to distinguish different incarnations |
| 436 // of the same RPH from each other. Unlike |id_| this is not globally unique, | 424 // of the same RPH from each other. Unlike |id_| this is not globally unique, |
| 437 // but it is guaranteed to change every time Init() is called. | 425 // but it is guaranteed to change every time Init() is called. |
| 438 int instance_id_ = 1; | 426 int instance_id_ = 1; |
| 439 | 427 |
| 440 BrowserContext* browser_context_; | 428 BrowserContext* browser_context_; |
| (...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 534 mojo::ScopedMessagePipeHandle in_process_renderer_handle_; | 522 mojo::ScopedMessagePipeHandle in_process_renderer_handle_; |
| 535 | 523 |
| 536 base::WeakPtrFactory<RenderProcessHostImpl> weak_factory_; | 524 base::WeakPtrFactory<RenderProcessHostImpl> weak_factory_; |
| 537 | 525 |
| 538 DISALLOW_COPY_AND_ASSIGN(RenderProcessHostImpl); | 526 DISALLOW_COPY_AND_ASSIGN(RenderProcessHostImpl); |
| 539 }; | 527 }; |
| 540 | 528 |
| 541 } // namespace content | 529 } // namespace content |
| 542 | 530 |
| 543 #endif // CONTENT_BROWSER_RENDERER_HOST_RENDER_PROCESS_HOST_IMPL_H_ | 531 #endif // CONTENT_BROWSER_RENDERER_HOST_RENDER_PROCESS_HOST_IMPL_H_ |
| OLD | NEW |