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

Side by Side Diff: content/browser/gpu/gpu_process_host_ui_shim.h

Issue 2723013004: gpu: Replace more chrome ipc with mojom API. (Closed)
Patch Set: tot merge Created 3 years, 9 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 | « content/browser/gpu/gpu_process_host.h ('k') | content/browser/gpu/gpu_process_host_ui_shim.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_GPU_GPU_PROCESS_HOST_UI_SHIM_H_ 5 #ifndef CONTENT_BROWSER_GPU_GPU_PROCESS_HOST_UI_SHIM_H_
6 #define CONTENT_BROWSER_GPU_GPU_PROCESS_HOST_UI_SHIM_H_ 6 #define CONTENT_BROWSER_GPU_GPU_PROCESS_HOST_UI_SHIM_H_
7 7
8 // This class lives on the UI thread and supports classes like the 8 // This class lives on the UI thread and supports classes like the
9 // BackingStoreProxy, which must live on the UI thread. The IO thread 9 // BackingStoreProxy, which must live on the UI thread. The IO thread
10 // portion of this class, the GpuProcessHost, is responsible for 10 // portion of this class, the GpuProcessHost, is responsible for
(...skipping 17 matching lines...) Expand all
28 #include "ipc/message_router.h" 28 #include "ipc/message_router.h"
29 29
30 namespace IPC { 30 namespace IPC {
31 class Message; 31 class Message;
32 } 32 }
33 33
34 namespace content { 34 namespace content {
35 void RouteToGpuProcessHostUIShimTask(int host_id, const IPC::Message& msg); 35 void RouteToGpuProcessHostUIShimTask(int host_id, const IPC::Message& msg);
36 36
37 class GpuProcessHostUIShim : public IPC::Listener, 37 class GpuProcessHostUIShim : public IPC::Listener,
38 public IPC::Sender,
39 public base::NonThreadSafe { 38 public base::NonThreadSafe {
40 public: 39 public:
41 // Create a GpuProcessHostUIShim with the given ID. The object can be found 40 // Create a GpuProcessHostUIShim with the given ID. The object can be found
42 // using FromID with the same id. 41 // using FromID with the same id.
43 static GpuProcessHostUIShim* Create(int host_id); 42 static GpuProcessHostUIShim* Create(int host_id);
44 43
45 // Destroy the GpuProcessHostUIShim with the given host ID. This can only 44 // Destroy the GpuProcessHostUIShim with the given host ID. This can only
46 // be called on the UI thread. Only the GpuProcessHost should destroy the 45 // be called on the UI thread. Only the GpuProcessHost should destroy the
47 // UI shim. 46 // UI shim.
48 static void Destroy(int host_id, const std::string& message); 47 static void Destroy(int host_id, const std::string& message);
49 48
50 // Destroy all remaining GpuProcessHostUIShims. 49 // Destroy all remaining GpuProcessHostUIShims.
51 CONTENT_EXPORT static void DestroyAll(); 50 CONTENT_EXPORT static void DestroyAll();
52 51
53 CONTENT_EXPORT static GpuProcessHostUIShim* FromID(int host_id); 52 CONTENT_EXPORT static GpuProcessHostUIShim* FromID(int host_id);
54 53
55 // Get a GpuProcessHostUIShim instance; it doesn't matter which one.
56 // Return NULL if none has been created.
57 CONTENT_EXPORT static GpuProcessHostUIShim* GetOneInstance();
58
59 // Stops the GPU process. 54 // Stops the GPU process.
60 CONTENT_EXPORT void StopGpuProcess(const base::Closure& callback); 55 CONTENT_EXPORT void StopGpuProcess(const base::Closure& callback);
61 56
62 // IPC::Sender implementation.
63 bool Send(IPC::Message* msg) override;
64
65 // IPC::Listener implementation. 57 // IPC::Listener implementation.
66 // The GpuProcessHost causes this to be called on the UI thread to 58 // The GpuProcessHost causes this to be called on the UI thread to
67 // dispatch the incoming messages from the GPU process, which are 59 // dispatch the incoming messages from the GPU process, which are
68 // actually received on the IO thread. 60 // actually received on the IO thread.
69 bool OnMessageReceived(const IPC::Message& message) override; 61 bool OnMessageReceived(const IPC::Message& message) override;
70 62
71 CONTENT_EXPORT void SimulateRemoveAllContext();
72 CONTENT_EXPORT void SimulateCrash();
73 CONTENT_EXPORT void SimulateHang();
74 #if defined(OS_ANDROID)
75 CONTENT_EXPORT void SimulateJavaCrash();
76 #endif
77
78 private: 63 private:
79 explicit GpuProcessHostUIShim(int host_id); 64 explicit GpuProcessHostUIShim(int host_id);
80 ~GpuProcessHostUIShim() override; 65 ~GpuProcessHostUIShim() override;
81 66
82 // Message handlers. 67 // Message handlers.
83 bool OnControlMessageReceived(const IPC::Message& message); 68 bool OnControlMessageReceived(const IPC::Message& message);
84 void OnLogMessage(int level, const std::string& header, 69 void OnLogMessage(int level, const std::string& header,
85 const std::string& message); 70 const std::string& message);
86 void OnGraphicsInfoCollected(const gpu::GPUInfo& gpu_info); 71 void OnGraphicsInfoCollected(const gpu::GPUInfo& gpu_info);
87 72
88 // The serial number of the GpuProcessHost / GpuProcessHostUIShim pair. 73 // The serial number of the GpuProcessHost / GpuProcessHostUIShim pair.
89 int host_id_; 74 int host_id_;
90 base::Closure close_callback_; 75 base::Closure close_callback_;
91 }; 76 };
92 77
93 } // namespace content 78 } // namespace content
94 79
95 #endif // CONTENT_BROWSER_GPU_GPU_PROCESS_HOST_UI_SHIM_H_ 80 #endif // CONTENT_BROWSER_GPU_GPU_PROCESS_HOST_UI_SHIM_H_
OLDNEW
« no previous file with comments | « content/browser/gpu/gpu_process_host.h ('k') | content/browser/gpu/gpu_process_host_ui_shim.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698