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

Side by Side Diff: content/common/gpu/gpu_channel_test_common.h

Issue 1711533002: Decouple browser-specific GPU IPC messages from GPU service IPCs (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Addressed sievers@'s comments Created 4 years, 10 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
OLDNEW
1 // Copyright (c) 2015 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2015 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 #include <stdint.h> 5 #include <stdint.h>
6 6
7 #include "base/memory/scoped_ptr.h" 7 #include "base/memory/scoped_ptr.h"
8 #include "content/common/gpu/gpu_channel.h" 8 #include "content/common/gpu/gpu_channel.h"
9 #include "content/common/gpu/gpu_channel_manager.h" 9 #include "content/common/gpu/gpu_channel_manager.h"
10 #include "content/common/gpu/gpu_channel_manager_delegate.h"
10 #include "testing/gtest/include/gtest/gtest.h" 11 #include "testing/gtest/include/gtest/gtest.h"
11 12
12 namespace base { 13 namespace base {
13 class TestSimpleTaskRunner; 14 class TestSimpleTaskRunner;
14 } // namespace base 15 } // namespace base
15 16
16 namespace IPC { 17 namespace IPC {
17 class TestSink; 18 class TestSink;
18 } // namespace IPC 19 } // namespace IPC
19 20
20 namespace content { 21 namespace content {
21 22
22 class SyncPointManager; 23 class SyncPointManager;
23 24
25 class TestGpuChannelManagerDelegate : public GpuChannelManagerDelegate {
26 public:
27 TestGpuChannelManagerDelegate();
28 ~TestGpuChannelManagerDelegate() override;
29
30 const IPC::ChannelHandle& last_established_channel_handle() const {
31 return last_established_channel_handle_;
32 }
33
34 private:
35 // GpuChannelManagerDelegate implementation:
36 void AddSubscription(int32_t client_id, unsigned int target) override;
37 void ChannelEstablished(const IPC::ChannelHandle& channel_handle) override;
38 void DidCreateOffscreenContext(const GURL& active_url) override;
39 void DidDestroyChannel(int client_id) override;
40 void DidDestroyOffscreenContext(const GURL& active_url) override;
41 void DidLoseContext(bool offscreen,
42 gpu::error::ContextLostReason reason,
43 const GURL& active_url) override;
44 void GpuMemoryUmaStats(const GPUMemoryUmaStats& params) override;
45 void RemoveSubscription(int32_t client_id, unsigned int target) override;
46 void StoreShaderToDisk(int32_t client_id,
47 const std::string& key,
48 const std::string& shader) override;
49
50 IPC::ChannelHandle last_established_channel_handle_;
51
52 DISALLOW_COPY_AND_ASSIGN(TestGpuChannelManagerDelegate);
53 };
54
24 class TestGpuChannelManager : public GpuChannelManager { 55 class TestGpuChannelManager : public GpuChannelManager {
25 public: 56 public:
26 TestGpuChannelManager(IPC::TestSink* sink, 57 TestGpuChannelManager(IPC::TestSink* sink,
58 GpuChannelManagerDelegate* delegate,
27 base::SingleThreadTaskRunner* task_runner, 59 base::SingleThreadTaskRunner* task_runner,
28 base::SingleThreadTaskRunner* io_task_runner, 60 base::SingleThreadTaskRunner* io_task_runner,
29 gpu::SyncPointManager* sync_point_manager, 61 gpu::SyncPointManager* sync_point_manager,
30 GpuMemoryBufferFactory* gpu_memory_buffer_factory); 62 GpuMemoryBufferFactory* gpu_memory_buffer_factory);
31 ~TestGpuChannelManager() override; 63 ~TestGpuChannelManager() override;
32 64
33 // IPC::Sender implementation.
34 bool Send(IPC::Message* msg) override;
35
36 protected: 65 protected:
37 scoped_ptr<GpuChannel> CreateGpuChannel( 66 scoped_ptr<GpuChannel> CreateGpuChannel(
38 int client_id, 67 int client_id,
39 uint64_t client_tracing_id, 68 uint64_t client_tracing_id,
40 bool preempts, 69 bool preempts,
41 bool allow_view_command_buffers, 70 bool allow_view_command_buffers,
42 bool allow_real_time_streams) override; 71 bool allow_real_time_streams) override;
43
44 private:
45 IPC::TestSink* const sink_; 72 IPC::TestSink* const sink_;
46 }; 73 };
47 74
48 class TestGpuChannel : public GpuChannel { 75 class TestGpuChannel : public GpuChannel {
49 public: 76 public:
50 TestGpuChannel(IPC::TestSink* sink, 77 TestGpuChannel(IPC::TestSink* sink,
51 GpuChannelManager* gpu_channel_manager, 78 GpuChannelManager* gpu_channel_manager,
52 gpu::SyncPointManager* sync_point_manager, 79 gpu::SyncPointManager* sync_point_manager,
53 gfx::GLShareGroup* share_group, 80 gfx::GLShareGroup* share_group,
54 gpu::gles2::MailboxManager* mailbox_manager, 81 gpu::gles2::MailboxManager* mailbox_manager,
(...skipping 18 matching lines...) Expand all
73 }; 100 };
74 101
75 class GpuChannelTestCommon : public testing::Test { 102 class GpuChannelTestCommon : public testing::Test {
76 public: 103 public:
77 GpuChannelTestCommon(); 104 GpuChannelTestCommon();
78 ~GpuChannelTestCommon() override; 105 ~GpuChannelTestCommon() override;
79 106
80 protected: 107 protected:
81 IPC::TestSink* sink() { return sink_.get(); } 108 IPC::TestSink* sink() { return sink_.get(); }
82 GpuChannelManager* channel_manager() { return channel_manager_.get(); } 109 GpuChannelManager* channel_manager() { return channel_manager_.get(); }
110 TestGpuChannelManagerDelegate* channel_manager_delegate() {
111 return channel_manager_delegate_.get();
112 }
83 base::TestSimpleTaskRunner* task_runner() { return task_runner_.get(); } 113 base::TestSimpleTaskRunner* task_runner() { return task_runner_.get(); }
84 114
85 private: 115 private:
86 scoped_ptr<IPC::TestSink> sink_; 116 scoped_ptr<IPC::TestSink> sink_;
87 scoped_refptr<base::TestSimpleTaskRunner> task_runner_; 117 scoped_refptr<base::TestSimpleTaskRunner> task_runner_;
88 scoped_refptr<base::TestSimpleTaskRunner> io_task_runner_; 118 scoped_refptr<base::TestSimpleTaskRunner> io_task_runner_;
89 scoped_ptr<gpu::SyncPointManager> sync_point_manager_; 119 scoped_ptr<gpu::SyncPointManager> sync_point_manager_;
120 scoped_ptr<TestGpuChannelManagerDelegate> channel_manager_delegate_;
90 scoped_ptr<GpuChannelManager> channel_manager_; 121 scoped_ptr<GpuChannelManager> channel_manager_;
91 }; 122 };
92 123
93 } // namespace content 124 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698