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

Side by Side Diff: content/renderer/gpu/frame_swap_message_queue.h

Issue 2789773003: Send FrameSwapMessageQueue's messages with a separate IPC (Closed)
Patch Set: Fix rebase mistake Created 3 years, 8 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/common/view_messages.h ('k') | content/renderer/gpu/frame_swap_message_queue.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 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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_RENDERER_GPU_FRAME_SWAP_MESSAGE_QUEUE_H_ 5 #ifndef CONTENT_RENDERER_GPU_FRAME_SWAP_MESSAGE_QUEUE_H_
6 #define CONTENT_RENDERER_GPU_FRAME_SWAP_MESSAGE_QUEUE_H_ 6 #define CONTENT_RENDERER_GPU_FRAME_SWAP_MESSAGE_QUEUE_H_
7 7
8 #include <map> 8 #include <map>
9 #include <memory> 9 #include <memory>
10 #include <vector> 10 #include <vector>
11 11
12 #include "base/auto_reset.h" 12 #include "base/auto_reset.h"
13 #include "base/macros.h" 13 #include "base/macros.h"
14 #include "base/memory/ref_counted.h" 14 #include "base/memory/ref_counted.h"
15 #include "base/synchronization/lock.h" 15 #include "base/synchronization/lock.h"
16 #include "cc/output/swap_promise.h" 16 #include "cc/output/swap_promise.h"
17 #include "content/common/content_export.h" 17 #include "content/common/content_export.h"
18 #include "content/renderer/message_delivery_policy.h" 18 #include "content/renderer/message_delivery_policy.h"
19 19
20 namespace IPC { 20 namespace IPC {
21 class Message; 21 class Message;
22 }; 22 };
23 23
24 namespace content { 24 namespace content {
25 25
26 class FrameSwapMessageSubQueue; 26 class FrameSwapMessageSubQueue;
27 27
28 // Queue used to keep track of which IPC::Messages should be sent along with a 28 // Queue used to keep track of which IPC::Messages should be sent after a
29 // particular compositor frame swap. 29 // particular compositor frame swap. The messages are guaranteed to be processed
30 // after the frame is processed, but there is no guarantee that nothing else
31 // happens between processing the frame and processing the messages.
30 class CONTENT_EXPORT FrameSwapMessageQueue 32 class CONTENT_EXPORT FrameSwapMessageQueue
31 : public base::RefCountedThreadSafe<FrameSwapMessageQueue> { 33 : public base::RefCountedThreadSafe<FrameSwapMessageQueue> {
32 public: 34 public:
33 class CONTENT_EXPORT SendMessageScope { 35 class CONTENT_EXPORT SendMessageScope {
34 public: 36 public:
35 virtual ~SendMessageScope() {} 37 virtual ~SendMessageScope() {}
36 }; 38 };
37 39
38 FrameSwapMessageQueue(); 40 FrameSwapMessageQueue();
39 41
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after
87 // threads (impl/main) are scheduled in the right order on the IO threads. 89 // threads (impl/main) are scheduled in the right order on the IO threads.
88 // 90 //
89 // Returns an object that must be kept in scope till an IPC message containing 91 // Returns an object that must be kept in scope till an IPC message containing
90 // |messages| is sent. 92 // |messages| is sent.
91 std::unique_ptr<SendMessageScope> AcquireSendMessageScope(); 93 std::unique_ptr<SendMessageScope> AcquireSendMessageScope();
92 94
93 static void TransferMessages( 95 static void TransferMessages(
94 std::vector<std::unique_ptr<IPC::Message>>* source, 96 std::vector<std::unique_ptr<IPC::Message>>* source,
95 std::vector<IPC::Message>* dest); 97 std::vector<IPC::Message>* dest);
96 98
99 uint32_t AllocateFrameToken();
100
97 private: 101 private:
98 friend class base::RefCountedThreadSafe<FrameSwapMessageQueue>; 102 friend class base::RefCountedThreadSafe<FrameSwapMessageQueue>;
99 103
100 FrameSwapMessageSubQueue* GetSubQueue(MessageDeliveryPolicy policy); 104 FrameSwapMessageSubQueue* GetSubQueue(MessageDeliveryPolicy policy);
101 105
102 ~FrameSwapMessageQueue(); 106 ~FrameSwapMessageQueue();
103 107
104 mutable base::Lock lock_; 108 mutable base::Lock lock_;
105 std::unique_ptr<FrameSwapMessageSubQueue> visual_state_queue_; 109 std::unique_ptr<FrameSwapMessageSubQueue> visual_state_queue_;
106 std::unique_ptr<FrameSwapMessageSubQueue> swap_queue_; 110 std::unique_ptr<FrameSwapMessageSubQueue> swap_queue_;
107 std::vector<std::unique_ptr<IPC::Message>> next_drain_messages_; 111 std::vector<std::unique_ptr<IPC::Message>> next_drain_messages_;
112 uint32_t last_used_frame_token_ = 0;
108 113
109 DISALLOW_COPY_AND_ASSIGN(FrameSwapMessageQueue); 114 DISALLOW_COPY_AND_ASSIGN(FrameSwapMessageQueue);
110 }; 115 };
111 116
112 } // namespace content 117 } // namespace content
113 118
114 #endif // CONTENT_RENDERER_GPU_FRAME_SWAP_MESSAGE_QUEUE_H_ 119 #endif // CONTENT_RENDERER_GPU_FRAME_SWAP_MESSAGE_QUEUE_H_
OLDNEW
« no previous file with comments | « content/common/view_messages.h ('k') | content/renderer/gpu/frame_swap_message_queue.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698