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

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

Issue 2899073006: Send FrameSwapMessageQueue's messages in QueueMessageSwapPromise (Closed)
Patch Set: Fixed memory leak Created 3 years, 6 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/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>
(...skipping 19 matching lines...) Expand all
30 // after the frame is processed, but there is no guarantee that nothing else 30 // after the frame is processed, but there is no guarantee that nothing else
31 // happens between processing the frame and processing the messages. 31 // happens between processing the frame and processing the messages.
32 class CONTENT_EXPORT FrameSwapMessageQueue 32 class CONTENT_EXPORT FrameSwapMessageQueue
33 : public base::RefCountedThreadSafe<FrameSwapMessageQueue> { 33 : public base::RefCountedThreadSafe<FrameSwapMessageQueue> {
34 public: 34 public:
35 class CONTENT_EXPORT SendMessageScope { 35 class CONTENT_EXPORT SendMessageScope {
36 public: 36 public:
37 virtual ~SendMessageScope() {} 37 virtual ~SendMessageScope() {}
38 }; 38 };
39 39
40 FrameSwapMessageQueue(); 40 explicit FrameSwapMessageQueue(int32_t routing_id);
41 41
42 // Queues message to be returned on a matching DrainMessages call. 42 // Queues message to be returned on a matching DrainMessages call.
43 // 43 //
44 // |policy| determines how messages are matched with DrainMessages calls. 44 // |policy| determines how messages are matched with DrainMessages calls.
45 // |source_frame_number| frame number to queue |msg| for. 45 // |source_frame_number| frame number to queue |msg| for.
46 // |msg| - message to queue. The method takes ownership of |msg|. 46 // |msg| - message to queue. The method takes ownership of |msg|.
47 // |is_first| - output parameter. Set to true if this was the first message 47 // |is_first| - output parameter. Set to true if this was the first message
48 // enqueued for the given source_frame_number. 48 // enqueued for the given source_frame_number.
49 void QueueMessageForFrame(MessageDeliveryPolicy policy, 49 void QueueMessageForFrame(MessageDeliveryPolicy policy,
50 int source_frame_number, 50 int source_frame_number,
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after
91 // 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
92 // |messages| is sent. 92 // |messages| is sent.
93 std::unique_ptr<SendMessageScope> AcquireSendMessageScope(); 93 std::unique_ptr<SendMessageScope> AcquireSendMessageScope();
94 94
95 static void TransferMessages( 95 static void TransferMessages(
96 std::vector<std::unique_ptr<IPC::Message>>* source, 96 std::vector<std::unique_ptr<IPC::Message>>* source,
97 std::vector<IPC::Message>* dest); 97 std::vector<IPC::Message>* dest);
98 98
99 uint32_t AllocateFrameToken(); 99 uint32_t AllocateFrameToken();
100 100
101 int32_t routing_id() const { return routing_id_; }
102
101 private: 103 private:
102 friend class base::RefCountedThreadSafe<FrameSwapMessageQueue>; 104 friend class base::RefCountedThreadSafe<FrameSwapMessageQueue>;
103 105
104 FrameSwapMessageSubQueue* GetSubQueue(MessageDeliveryPolicy policy); 106 FrameSwapMessageSubQueue* GetSubQueue(MessageDeliveryPolicy policy);
105 107
106 ~FrameSwapMessageQueue(); 108 ~FrameSwapMessageQueue();
107 109
108 mutable base::Lock lock_; 110 mutable base::Lock lock_;
109 std::unique_ptr<FrameSwapMessageSubQueue> visual_state_queue_; 111 std::unique_ptr<FrameSwapMessageSubQueue> visual_state_queue_;
110 std::unique_ptr<FrameSwapMessageSubQueue> swap_queue_; 112 std::unique_ptr<FrameSwapMessageSubQueue> swap_queue_;
111 std::vector<std::unique_ptr<IPC::Message>> next_drain_messages_; 113 std::vector<std::unique_ptr<IPC::Message>> next_drain_messages_;
112 uint32_t last_used_frame_token_ = 0; 114 uint32_t last_used_frame_token_ = 0;
115 int32_t routing_id_ = 0;
113 116
114 DISALLOW_COPY_AND_ASSIGN(FrameSwapMessageQueue); 117 DISALLOW_COPY_AND_ASSIGN(FrameSwapMessageQueue);
115 }; 118 };
116 119
117 } // namespace content 120 } // namespace content
118 121
119 #endif // CONTENT_RENDERER_GPU_FRAME_SWAP_MESSAGE_QUEUE_H_ 122 #endif // CONTENT_RENDERER_GPU_FRAME_SWAP_MESSAGE_QUEUE_H_
OLDNEW
« no previous file with comments | « no previous file | content/renderer/gpu/frame_swap_message_queue.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698