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

Side by Side Diff: ppapi/examples/audio_input/audio_input.cc

Issue 9615050: Remove NewRequiredCallback. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 8 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
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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 #include <string.h> 5 #include <string.h>
6 6
7 #include <algorithm> 7 #include <algorithm>
8 #include <limits> 8 #include <limits>
9 9
10 #include "ppapi/cpp/audio_config.h" 10 #include "ppapi/cpp/audio_config.h"
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after
73 return; 73 return;
74 74
75 Paint(); 75 Paint();
76 } 76 }
77 77
78 private: 78 private:
79 void ScheduleNextTimer() { 79 void ScheduleNextTimer() {
80 PP_DCHECK(timer_interval_ > 0); 80 PP_DCHECK(timer_interval_ > 0);
81 pp::Module::Get()->core()->CallOnMainThread( 81 pp::Module::Get()->core()->CallOnMainThread(
82 timer_interval_, 82 timer_interval_,
83 callback_factory_.NewRequiredCallback(&MyInstance::OnTimer), 83 callback_factory_.NewCallback(&MyInstance::OnTimer),
84 0); 84 0);
85 } 85 }
86 86
87 void OnTimer(int32_t) { 87 void OnTimer(int32_t) {
88 ScheduleNextTimer(); 88 ScheduleNextTimer();
89 Paint(); 89 Paint();
90 } 90 }
91 91
92 void DidFlush(int32_t result) { 92 void DidFlush(int32_t result) {
93 waiting_for_flush_completion_ = false; 93 waiting_for_flush_completion_ = false;
(...skipping 10 matching lines...) Expand all
104 pending_paint_ = false; 104 pending_paint_ = false;
105 105
106 if (size_.IsEmpty()) 106 if (size_.IsEmpty())
107 return; // Nothing to do. 107 return; // Nothing to do.
108 108
109 pp::ImageData image = PaintImage(size_); 109 pp::ImageData image = PaintImage(size_);
110 if (!image.is_null()) { 110 if (!image.is_null()) {
111 device_context_.ReplaceContents(&image); 111 device_context_.ReplaceContents(&image);
112 waiting_for_flush_completion_ = true; 112 waiting_for_flush_completion_ = true;
113 device_context_.Flush( 113 device_context_.Flush(
114 callback_factory_.NewRequiredCallback(&MyInstance::DidFlush)); 114 callback_factory_.NewCallback(&MyInstance::DidFlush));
115 } 115 }
116 } 116 }
117 117
118 pp::ImageData PaintImage(const pp::Size& size) { 118 pp::ImageData PaintImage(const pp::Size& size) {
119 pp::ImageData image(this, PP_IMAGEDATAFORMAT_BGRA_PREMUL, size, false); 119 pp::ImageData image(this, PP_IMAGEDATAFORMAT_BGRA_PREMUL, size, false);
120 if (image.is_null()) 120 if (image.is_null())
121 return image; 121 return image;
122 122
123 // Clear to dark grey. 123 // Clear to dark grey.
124 for (int y = 0; y < size.height(); y++) { 124 for (int y = 0; y < size.height(); y++) {
(...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after
186 }; 186 };
187 187
188 namespace pp { 188 namespace pp {
189 189
190 // Factory function for your specialization of the Module object. 190 // Factory function for your specialization of the Module object.
191 Module* CreateModule() { 191 Module* CreateModule() {
192 return new MyModule(); 192 return new MyModule();
193 } 193 }
194 194
195 } // namespace pp 195 } // namespace pp
OLDNEW
« no previous file with comments | « no previous file | ppapi/examples/flash_topmost/flash_topmost.cc » ('j') | ppapi/utility/completion_callback_factory.h » ('J')

Powered by Google App Engine
This is Rietveld 408576698