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

Side by Side Diff: chrome/renderer/pepper_devices.h

Issue 6646025: Deleted WebPluginDelegatePepper. (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 9 years, 9 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
« no previous file with comments | « chrome/common/chrome_switches.cc ('k') | chrome/renderer/pepper_devices.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
1 // Copyright (c) 2010 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 CHROME_RENDERER_PEPPER_DEVICES_H_
6 #define CHROME_RENDERER_PEPPER_DEVICES_H_
7 #pragma once
8
9 #include "app/surface/transport_dib.h"
10 #include "base/basictypes.h"
11 #include "base/scoped_ptr.h"
12 #include "base/shared_memory.h"
13 #include "base/threading/simple_thread.h"
14 #include "chrome/renderer/audio_message_filter.h"
15 #include "third_party/npapi/bindings/npapi.h"
16 #include "third_party/npapi/bindings/npapi_extensions.h"
17 #include "ui/gfx/rect.h"
18
19 class WebPluginDelegatePepper;
20 class SkBitmap;
21
22 // Lists all contexts currently open for painting. These are ones requested by
23 // the plugin but not destroyed by it yet. The source pointer is the raw
24 // pixels. We use this to look up the corresponding transport DIB when the
25 // plugin tells us to flush or destroy it.
26 class Graphics2DDeviceContext {
27 public:
28 explicit Graphics2DDeviceContext(WebPluginDelegatePepper* plugin_delegate);
29 ~Graphics2DDeviceContext();
30
31 NPError Initialize(gfx::Rect window_rect,
32 const NPDeviceContext2DConfig* config,
33 NPDeviceContext2D* context);
34
35 NPError Flush(SkBitmap* commited_bitmap, NPDeviceContext2D* context,
36 NPDeviceFlushContextCallbackPtr callback, NPP id,
37 void* user_data);
38
39 // Notifications that the render view has rendered the page and that it has
40 // been flushed to the screen.
41 void RenderViewInitiatedPaint();
42 void RenderViewFlushedPaint();
43
44 TransportDIB* transport_dib() { return transport_dib_.get(); }
45 skia::PlatformCanvas* canvas() { return canvas_.get(); }
46
47 private:
48 struct FlushCallbackData;
49 typedef std::vector<FlushCallbackData> FlushCallbackVector;
50
51 WebPluginDelegatePepper* plugin_delegate_;
52
53 static int32 next_buffer_id_;
54 scoped_ptr<TransportDIB> transport_dib_;
55
56 // The canvas associated with the transport DIB, containing the mapped
57 // memory of the image.
58 scoped_ptr<skia::PlatformCanvas> canvas_;
59
60 // The plugin may be constantly giving us paint messages. "Unpainted" ones
61 // are paint requests which have never been painted. These could have been
62 // done while the RenderView was already waiting for an ACK from a previous
63 // paint, so won't generate a new one yet.
64 //
65 // "Painted" ones are those paints that have been painted by RenderView, but
66 // for which the ACK from the browser has not yet been received.
67 //
68 // When we get updates from a plugin with a callback, it is first added to
69 // the unpainted callbacks. When the renderer has initiated a paint, we'll
70 // move it to the painted callbacks list. When the renderer receives a flush,
71 // we'll execute the callback and remove it from the list.
72 FlushCallbackVector unpainted_flush_callbacks_;
73 FlushCallbackVector painted_flush_callbacks_;
74
75 DISALLOW_COPY_AND_ASSIGN(Graphics2DDeviceContext);
76 };
77
78
79 // Each instance of AudioDeviceContext corresponds to one host stream (and one
80 // audio context). NPDeviceContextAudio contains the id of the context's
81 // stream in the privatePtr member.
82 class AudioDeviceContext : public AudioMessageFilter::Delegate,
83 public base::DelegateSimpleThread::Delegate {
84 public:
85 explicit AudioDeviceContext();
86 virtual ~AudioDeviceContext();
87
88 NPError Initialize(AudioMessageFilter* filter,
89 const NPDeviceContextAudioConfig* config,
90 NPDeviceContextAudio* context);
91
92 base::SharedMemory* shared_memory() { return shared_memory_.get(); }
93 uint32 shared_memory_size() { return shared_memory_size_; }
94 base::SyncSocket* socket() { return socket_.get(); }
95
96 private:
97
98 // AudioMessageFilter::Delegate implementation
99 virtual void OnRequestPacket(AudioBuffersState buffers_state);
100 virtual void OnStateChanged(const ViewMsg_AudioStreamState_Params& state);
101 virtual void OnCreated(base::SharedMemoryHandle handle, uint32 length);
102 virtual void OnLowLatencyCreated(base::SharedMemoryHandle handle,
103 base::SyncSocket::Handle socket_handle,
104 uint32 length);
105 virtual void OnVolume(double volume);
106 virtual void OnDestroy();
107 // End of AudioMessageFilter::Delegate implementation
108
109 // DelegateSimpleThread::Delegate implementation
110 virtual void Run();
111 // End of DelegateSimpleThread::Delegate implementation
112
113 void FireAudioCallback() {
114 if (context_ && context_->config.callback) {
115 context_->config.callback(context_);
116 }
117 }
118
119 NPDeviceContextAudio* context_;
120 scoped_refptr<AudioMessageFilter> filter_;
121 int32 stream_id_;
122 scoped_ptr<base::SharedMemory> shared_memory_;
123 uint32 shared_memory_size_;
124 scoped_ptr<base::SyncSocket> socket_;
125 scoped_ptr<base::DelegateSimpleThread> audio_thread_;
126 };
127
128 #endif // CHROME_RENDERER_PEPPER_DEVICES_H_
OLDNEW
« no previous file with comments | « chrome/common/chrome_switches.cc ('k') | chrome/renderer/pepper_devices.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698