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

Side by Side Diff: remoting/client/plugin/chromoting_plugin.cc

Issue 2852024: Chromium side changes to use PP_CompletionCallback as the Flush callback.... (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: '' Created 10 years, 5 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 | « DEPS ('k') | webkit/glue/plugins/pepper_device_context_2d.h » ('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 (c) 2010 The Chromium Authors. All rights reserved. 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 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 "remoting/client/plugin/chromoting_plugin.h" 5 #include "remoting/client/plugin/chromoting_plugin.h"
6 6
7 #include <string> 7 #include <string>
8 #include <vector> 8 #include <vector>
9 9
10 #include "base/string_util.h" 10 #include "base/string_util.h"
11 #include "base/thread.h" 11 #include "base/thread.h"
12 #include "remoting/client/chromoting_client.h" 12 #include "remoting/client/chromoting_client.h"
13 #include "remoting/client/host_connection.h" 13 #include "remoting/client/host_connection.h"
14 #include "remoting/client/jingle_host_connection.h" 14 #include "remoting/client/jingle_host_connection.h"
15 #include "remoting/client/plugin/pepper_view.h" 15 #include "remoting/client/plugin/pepper_view.h"
16 #include "remoting/jingle_glue/jingle_thread.h" 16 #include "remoting/jingle_glue/jingle_thread.h"
17 #include "third_party/ppapi/c/pp_event.h" 17 #include "third_party/ppapi/c/pp_event.h"
18 #include "third_party/ppapi/c/pp_rect.h" 18 #include "third_party/ppapi/c/pp_rect.h"
19 #include "third_party/ppapi/cpp/completion_callback.h"
19 #include "third_party/ppapi/cpp/image_data.h" 20 #include "third_party/ppapi/cpp/image_data.h"
20 21
21 using std::string; 22 using std::string;
22 using std::vector; 23 using std::vector;
23 24
24 namespace remoting { 25 namespace remoting {
25 26
26 const char* ChromotingPlugin::kMimeType = 27 const char* ChromotingPlugin::kMimeType =
27 "pepper-application/x-chromoting-plugin::Chromoting"; 28 "pepper-application/x-chromoting-plugin::Chromoting";
28 29
(...skipping 11 matching lines...) Expand all
40 // to the message loop before this point. Right now, we don't have a well 41 // to the message loop before this point. Right now, we don't have a well
41 // defined stop for the plugin process, and the thread shutdown is likely a 42 // defined stop for the plugin process, and the thread shutdown is likely a
42 // race condition. 43 // race condition.
43 if (network_thread_.get()) 44 if (network_thread_.get())
44 network_thread_->Stop(); 45 network_thread_->Stop();
45 46
46 if (main_thread_.get()) 47 if (main_thread_.get())
47 main_thread_->Stop(); 48 main_thread_->Stop();
48 } 49 }
49 50
50 bool ChromotingPlugin::Init(uint32_t argc, const char* argn[], const char* argv[ ]) { 51 bool ChromotingPlugin::Init(uint32_t argc,
52 const char* argn[],
53 const char* argv[]) {
51 LOG(INFO) << "Started ChromotingPlugin::Init"; 54 LOG(INFO) << "Started ChromotingPlugin::Init";
52 55
53 // Extract the URL from the arguments. 56 // Extract the URL from the arguments.
54 const char* url = NULL; 57 const char* url = NULL;
55 for (uint32_t i = 0; i < argc; ++i) { 58 for (uint32_t i = 0; i < argc; ++i) {
56 if (strcmp(argn[i], "src") == 0) { 59 if (strcmp(argn[i], "src") == 0) {
57 url = argv[i]; 60 url = argv[i];
58 break; 61 break;
59 } 62 }
60 } 63 }
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after
119 } 122 }
120 123
121 pp::ImageData image(PP_IMAGEDATAFORMAT_BGRA_PREMUL, width_, height_, false); 124 pp::ImageData image(PP_IMAGEDATAFORMAT_BGRA_PREMUL, width_, height_, false);
122 if (!image.is_null()) { 125 if (!image.is_null()) {
123 for (int y = 0; y < image.height(); y++) { 126 for (int y = 0; y < image.height(); y++) {
124 for (int x = 0; x < image.width(); x++) { 127 for (int x = 0; x < image.width(); x++) {
125 *image.GetAddr32(x, y) = 0xccff00cc; 128 *image.GetAddr32(x, y) = 0xccff00cc;
126 } 129 }
127 } 130 }
128 device_context_.ReplaceContents(&image); 131 device_context_.ReplaceContents(&image);
129 device_context_.Flush(NULL, this); 132 device_context_.Flush(pp::CompletionCallback(NULL, this));
130 } else { 133 } else {
131 LOG(ERROR) << "Unable to allocate image."; 134 LOG(ERROR) << "Unable to allocate image.";
132 } 135 }
133 136
134 //client_->SetViewport(0, 0, width_, height_); 137 //client_->SetViewport(0, 0, width_, height_);
135 //client_->Repaint(); 138 //client_->Repaint();
136 } 139 }
137 140
138 bool ChromotingPlugin::HandleEvent(const PP_Event& event) { 141 bool ChromotingPlugin::HandleEvent(const PP_Event& event) {
139 switch (event.type) { 142 switch (event.type) {
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after
187 pos = parts[2].rfind('='); 190 pos = parts[2].rfind('=');
188 if (pos == string::npos && (pos + 1) != string::npos) { 191 if (pos == string::npos && (pos + 1) != string::npos) {
189 return false; 192 return false;
190 } 193 }
191 host_jid->assign(parts[2].substr(pos + 1)); 194 host_jid->assign(parts[2].substr(pos + 1));
192 195
193 return true; 196 return true;
194 } 197 }
195 198
196 } // namespace remoting 199 } // namespace remoting
OLDNEW
« no previous file with comments | « DEPS ('k') | webkit/glue/plugins/pepper_device_context_2d.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698