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

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: who needs a frame number 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/auto_reset.h"
12 #include "base/memory/ref_counted.h"
13 #include "base/memory/scoped_ptr.h"
14 #include "base/memory/scoped_vector.h"
15 #include "base/synchronization/lock.h"
16 #include "content/common/content_export.h"
17
18 namespace IPC {
19 class Message;
20 };
21
22 namespace content {
23
24 // Queue used to keep track of which IPC::Messages should be sent along with a
25 // particular compositor frame swap.
26 class CONTENT_EXPORT FrameSwapMessageQueue
27 : public base::RefCountedThreadSafe<FrameSwapMessageQueue> {
28 public:
29 class CONTENT_EXPORT SendMessageScope {
30 public:
31 virtual ~SendMessageScope() {}
32 };
33
34 FrameSwapMessageQueue();
35
36 // Queues message to be sent on next drain.
37 //
38 // |msg| - message to queue. The method takes ownership of |msg|.
39 void QueueMessage(IPC::Message* msg);
40
41 // A SendMessageScope object must be held by the caller when this method is
42 // called.
43 //
44 // |messages| vector to store messages. it's not cleared, only appended to.
45 void DrainMessages(std::vector<IPC::Message>* messages);
46
47 // SendMessageScope is used to make sure that messages sent from different
48 // threads (impl/main) are scheduled in the right order on the IO threads.
49 //
50 // Returns an object that must be kept in scope till an IPC message containing
51 // |messages| is sent.
52 scoped_ptr<SendMessageScope> AcquireSendMessageScope();
53
54 private:
55 friend class base::RefCountedThreadSafe<FrameSwapMessageQueue>;
56
57 ~FrameSwapMessageQueue();
58
59 base::Lock lock_;
60 ScopedVector<IPC::Message> queued_messages_;
61 bool send_message_scope_aquired_;
62
63 DISALLOW_COPY_AND_ASSIGN(FrameSwapMessageQueue);
64 };
65
66 } // namespace content
67
68 #endif // CONTENT_RENDERER_GPU_FRAME_SWAP_MESSAGE_QUEUE_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698