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

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

Issue 240163005: Deliver IPC messages together with SwapCompositorFrame (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: don't use metadata to stash IPC messages Created 6 years, 7 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 | Annotate | Revision Log
OLDNEW
(Empty)
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
3 // found in the LICENSE file.
4
5 #ifndef CONTENT_RENDERER_GPU_FRAME_SWAP_MESSAGE_QUEUE_H_
6 #define CONTENT_RENDERER_GPU_FRAME_SWAP_MESSAGE_QUEUE_H_
7
8 #include <map>
9 #include <vector>
10
11 #include "base/memory/ref_counted.h"
12 #include "base/synchronization/lock.h"
13
14 namespace IPC {
15 class Message;
16 };
17
18 namespace content {
19
20 class FrameSwapMessageQueue :
21 public base::RefCountedThreadSafe<FrameSwapMessageQueue> {
22 public:
23 FrameSwapMessageQueue();
24
25 // takes ownership of |msg|
26 void QueueMessage(IPC::Message* msg);
27 // takes ownership of |msg|
28 // returns false if the given frame number had already been drained.
29 bool TryQueueMessage(int source_frame_number, IPC::Message* msg);
30 void DrainMessages(int source_frame_number,
31 std::vector<IPC::Message>* messages);
32
33 private:
34 friend class base::RefCountedThreadSafe<FrameSwapMessageQueue>;
35 ~FrameSwapMessageQueue();
36 typedef std::map<int, std::vector<IPC::Message*> > FrameQueueMap;
37
38 base::Lock lock_;
39 int highest_swapped_source_frame_number_;
40 FrameQueueMap queued_messages_;
41
42 DISALLOW_COPY_AND_ASSIGN(FrameSwapMessageQueue);
43 };
44
45 } // namespace content
46
47 #endif // CONTENT_RENDERER_GPU_FRAME_SWAP_MESSAGE_QUEUE_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698