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

Side by Side Diff: content/browser/renderer_host/render_process_host_impl.h

Issue 2411093002: Always keep a ChannelProxy alive in RenderProcessHostImpl (Closed)
Patch Set: rebase Created 4 years, 2 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 | « no previous file | content/browser/renderer_host/render_process_host_impl.cc » ('j') | 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 #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 96 matching lines...) Expand 10 before | Expand all | Expand 10 after
107 public ui::GpuSwitchingObserver, 107 public ui::GpuSwitchingObserver,
108 public NON_EXPORTED_BASE(mojom::RouteProvider), 108 public NON_EXPORTED_BASE(mojom::RouteProvider),
109 public NON_EXPORTED_BASE(mojom::AssociatedInterfaceProvider) { 109 public NON_EXPORTED_BASE(mojom::AssociatedInterfaceProvider) {
110 public: 110 public:
111 RenderProcessHostImpl(BrowserContext* browser_context, 111 RenderProcessHostImpl(BrowserContext* browser_context,
112 StoragePartitionImpl* storage_partition_impl, 112 StoragePartitionImpl* storage_partition_impl,
113 bool is_for_guests_only); 113 bool is_for_guests_only);
114 ~RenderProcessHostImpl() override; 114 ~RenderProcessHostImpl() override;
115 115
116 // RenderProcessHost implementation (public portion). 116 // RenderProcessHost implementation (public portion).
117 void EnableSendQueue() override;
118 bool Init() override; 117 bool Init() override;
119 int GetNextRoutingID() override; 118 int GetNextRoutingID() override;
120 void AddRoute(int32_t routing_id, IPC::Listener* listener) override; 119 void AddRoute(int32_t routing_id, IPC::Listener* listener) override;
121 void RemoveRoute(int32_t routing_id) override; 120 void RemoveRoute(int32_t routing_id) override;
122 void AddObserver(RenderProcessHostObserver* observer) override; 121 void AddObserver(RenderProcessHostObserver* observer) override;
123 void RemoveObserver(RenderProcessHostObserver* observer) override; 122 void RemoveObserver(RenderProcessHostObserver* observer) override;
124 void ShutdownForBadMessage(CrashReportMode crash_report_mode) override; 123 void ShutdownForBadMessage(CrashReportMode crash_report_mode) override;
125 void WidgetRestored() override; 124 void WidgetRestored() override;
126 void WidgetHidden() override; 125 void WidgetHidden() override;
127 int VisibleWidgetCount() const override; 126 int VisibleWidgetCount() const override;
(...skipping 172 matching lines...) Expand 10 before | Expand all | Expand 10 after
300 private: 299 private:
301 friend class ChildProcessLauncherBrowserTest_ChildSpawnFail_Test; 300 friend class ChildProcessLauncherBrowserTest_ChildSpawnFail_Test;
302 friend class VisitRelayingRenderProcessHost; 301 friend class VisitRelayingRenderProcessHost;
303 class ConnectionFilterController; 302 class ConnectionFilterController;
304 class ConnectionFilterImpl; 303 class ConnectionFilterImpl;
305 304
306 size_t worker_ref_count() { 305 size_t worker_ref_count() {
307 return service_worker_ref_count_ + shared_worker_ref_count_; 306 return service_worker_ref_count_ + shared_worker_ref_count_;
308 } 307 }
309 308
310 std::unique_ptr<IPC::ChannelProxy> CreateChannelProxy(); 309 // Initializes a new IPC::ChannelProxy in |channel_|, which will be connected
310 // to the next child process launched for this host, if any.
311 void InitializeChannelProxy();
311 312
312 // Creates and adds the IO thread message filters. 313 // Creates and adds the IO thread message filters.
313 void CreateMessageFilters(); 314 void CreateMessageFilters();
314 315
315 // Registers Mojo interfaces to be exposed to the renderer. 316 // Registers Mojo interfaces to be exposed to the renderer.
316 void RegisterMojoInterfaces(); 317 void RegisterMojoInterfaces();
317 318
318 // mojom::RouteProvider: 319 // mojom::RouteProvider:
319 void GetRoute( 320 void GetRoute(
320 int32_t routing_id, 321 int32_t routing_id,
(...skipping 130 matching lines...) Expand 10 before | Expand all | Expand 10 after
451 // The filter for MessagePort messages coming from the renderer. 452 // The filter for MessagePort messages coming from the renderer.
452 scoped_refptr<MessagePortMessageFilter> message_port_message_filter_; 453 scoped_refptr<MessagePortMessageFilter> message_port_message_filter_;
453 454
454 // The filter for Web Notification messages coming from the renderer. Holds a 455 // The filter for Web Notification messages coming from the renderer. Holds a
455 // closure per notification that must be freed when the notification closes. 456 // closure per notification that must be freed when the notification closes.
456 scoped_refptr<NotificationMessageFilter> notification_message_filter_; 457 scoped_refptr<NotificationMessageFilter> notification_message_filter_;
457 458
458 // Used in single-process mode. 459 // Used in single-process mode.
459 std::unique_ptr<base::Thread> in_process_renderer_; 460 std::unique_ptr<base::Thread> in_process_renderer_;
460 461
461 // True after Init() has been called. We can't just check channel_ because we 462 // True after Init() has been called.
462 // also reset that in the case of process termination. 463 bool is_initialized_ = false;
463 bool is_initialized_; 464
465 // True after ProcessDied(), until the next call to Init().
466 bool is_dead_ = false;
464 467
465 // PlzNavigate 468 // PlzNavigate
466 // Stores the time at which the first call to Init happened. 469 // Stores the time at which the first call to Init happened.
467 base::TimeTicks init_time_; 470 base::TimeTicks init_time_;
468 471
469 // Used to launch and terminate the process without blocking the UI thread. 472 // Used to launch and terminate the process without blocking the UI thread.
470 std::unique_ptr<ChildProcessLauncher> child_process_launcher_; 473 std::unique_ptr<ChildProcessLauncher> child_process_launcher_;
471 474
472 // Messages we queue before the ChannelProxy is created.
473 using MessageQueue = std::queue<std::unique_ptr<IPC::Message>>;
474 MessageQueue queued_messages_;
475
476 // The globally-unique identifier for this RPH. 475 // The globally-unique identifier for this RPH.
477 const int id_; 476 const int id_;
478 477
479 // A secondary ID used by the Mojo shell to distinguish different incarnations 478 // A secondary ID used by the Mojo shell to distinguish different incarnations
480 // of the same RPH from each other. Unlike |id_| this is not globally unique, 479 // of the same RPH from each other. Unlike |id_| this is not globally unique,
481 // but it is guaranteed to change every time Init() is called. 480 // but it is guaranteed to change every time Init() is called.
482 int instance_id_ = 1; 481 int instance_id_ = 1;
483 482
484 BrowserContext* browser_context_; 483 BrowserContext* browser_context_;
485 484
(...skipping 100 matching lines...) Expand 10 before | Expand all | Expand 10 after
586 instance_weak_factory_; 585 instance_weak_factory_;
587 586
588 base::WeakPtrFactory<RenderProcessHostImpl> weak_factory_; 587 base::WeakPtrFactory<RenderProcessHostImpl> weak_factory_;
589 588
590 DISALLOW_COPY_AND_ASSIGN(RenderProcessHostImpl); 589 DISALLOW_COPY_AND_ASSIGN(RenderProcessHostImpl);
591 }; 590 };
592 591
593 } // namespace content 592 } // namespace content
594 593
595 #endif // CONTENT_BROWSER_RENDERER_HOST_RENDER_PROCESS_HOST_IMPL_H_ 594 #endif // CONTENT_BROWSER_RENDERER_HOST_RENDER_PROCESS_HOST_IMPL_H_
OLDNEW
« no previous file with comments | « no previous file | content/browser/renderer_host/render_process_host_impl.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698