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

Side by Side Diff: chrome/plugin/webplugin_delegate_stub.cc

Issue 6614030: Revert 76840 - Removed GPU plugin.... (Closed) Base URL: svn://svn.chromium.org/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/plugin/webplugin_delegate_stub.h ('k') | chrome/renderer/webplugin_delegate_pepper.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) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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 "chrome/plugin/webplugin_delegate_stub.h" 5 #include "chrome/plugin/webplugin_delegate_stub.h"
6 6
7 #include "build/build_config.h" 7 #include "build/build_config.h"
8 8
9 #include "base/command_line.h" 9 #include "base/command_line.h"
10 #include "chrome/common/child_process_logging.h" 10 #include "chrome/common/child_process_logging.h"
(...skipping 10 matching lines...) Expand all
21 #include "third_party/WebKit/Source/WebKit/chromium/public/WebCursorInfo.h" 21 #include "third_party/WebKit/Source/WebKit/chromium/public/WebCursorInfo.h"
22 #include "webkit/plugins/npapi/webplugin_delegate_impl.h" 22 #include "webkit/plugins/npapi/webplugin_delegate_impl.h"
23 #include "webkit/glue/webcursor.h" 23 #include "webkit/glue/webcursor.h"
24 24
25 #if defined(OS_WIN) 25 #if defined(OS_WIN)
26 #include "base/scoped_ptr.h" 26 #include "base/scoped_ptr.h"
27 #include "printing/native_metafile_factory.h" 27 #include "printing/native_metafile_factory.h"
28 #include "printing/native_metafile.h" 28 #include "printing/native_metafile.h"
29 #endif // defined(OS_WIN) 29 #endif // defined(OS_WIN)
30 30
31 #if defined(ENABLE_GPU)
32 #include "app/gfx/gl/gl_context.h"
33 #endif
34
31 using WebKit::WebBindings; 35 using WebKit::WebBindings;
32 using WebKit::WebCursorInfo; 36 using WebKit::WebCursorInfo;
33 using webkit::npapi::WebPlugin; 37 using webkit::npapi::WebPlugin;
34 using webkit::npapi::WebPluginResourceClient; 38 using webkit::npapi::WebPluginResourceClient;
35 39
36 class FinishDestructionTask : public Task { 40 class FinishDestructionTask : public Task {
37 public: 41 public:
38 FinishDestructionTask(webkit::npapi::WebPluginDelegateImpl* delegate, 42 FinishDestructionTask(webkit::npapi::WebPluginDelegateImpl* delegate,
39 WebPlugin* webplugin) 43 WebPlugin* webplugin)
40 : delegate_(delegate), webplugin_(webplugin) { 44 : delegate_(delegate), webplugin_(webplugin) {
(...skipping 20 matching lines...) Expand all
61 delegate_(NULL), 65 delegate_(NULL),
62 webplugin_(NULL), 66 webplugin_(NULL),
63 in_destructor_(false) { 67 in_destructor_(false) {
64 DCHECK(channel); 68 DCHECK(channel);
65 } 69 }
66 70
67 WebPluginDelegateStub::~WebPluginDelegateStub() { 71 WebPluginDelegateStub::~WebPluginDelegateStub() {
68 in_destructor_ = true; 72 in_destructor_ = true;
69 child_process_logging::SetActiveURL(page_url_); 73 child_process_logging::SetActiveURL(page_url_);
70 74
75 #if defined(ENABLE_GPU)
76 // Make sure there is no command buffer before destroying the window handle.
77 // The GPU service code might otherwise asynchronously perform an operation
78 // using the window handle.
79 command_buffer_stub_.reset();
80 #endif
81
71 if (channel_->in_send()) { 82 if (channel_->in_send()) {
72 // The delegate or an npobject is in the callstack, so don't delete it 83 // The delegate or an npobject is in the callstack, so don't delete it
73 // right away. 84 // right away.
74 MessageLoop::current()->PostNonNestableTask(FROM_HERE, 85 MessageLoop::current()->PostNonNestableTask(FROM_HERE,
75 new FinishDestructionTask(delegate_, webplugin_)); 86 new FinishDestructionTask(delegate_, webplugin_));
76 } else { 87 } else {
77 // Safe to delete right away. 88 // Safe to delete right away.
78 if (delegate_) 89 if (delegate_)
79 delegate_->PluginDestroyed(); 90 delegate_->PluginDestroyed();
80 91
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after
126 OnDidReceiveManualResponse) 137 OnDidReceiveManualResponse)
127 IPC_MESSAGE_HANDLER(PluginMsg_DidReceiveManualData, OnDidReceiveManualData) 138 IPC_MESSAGE_HANDLER(PluginMsg_DidReceiveManualData, OnDidReceiveManualData)
128 IPC_MESSAGE_HANDLER(PluginMsg_DidFinishManualLoading, 139 IPC_MESSAGE_HANDLER(PluginMsg_DidFinishManualLoading,
129 OnDidFinishManualLoading) 140 OnDidFinishManualLoading)
130 IPC_MESSAGE_HANDLER(PluginMsg_DidManualLoadFail, OnDidManualLoadFail) 141 IPC_MESSAGE_HANDLER(PluginMsg_DidManualLoadFail, OnDidManualLoadFail)
131 IPC_MESSAGE_HANDLER(PluginMsg_InstallMissingPlugin, OnInstallMissingPlugin) 142 IPC_MESSAGE_HANDLER(PluginMsg_InstallMissingPlugin, OnInstallMissingPlugin)
132 IPC_MESSAGE_HANDLER(PluginMsg_HandleURLRequestReply, 143 IPC_MESSAGE_HANDLER(PluginMsg_HandleURLRequestReply,
133 OnHandleURLRequestReply) 144 OnHandleURLRequestReply)
134 IPC_MESSAGE_HANDLER(PluginMsg_HTTPRangeRequestReply, 145 IPC_MESSAGE_HANDLER(PluginMsg_HTTPRangeRequestReply,
135 OnHTTPRangeRequestReply) 146 OnHTTPRangeRequestReply)
147 IPC_MESSAGE_HANDLER(PluginMsg_CreateCommandBuffer,
148 OnCreateCommandBuffer)
149 IPC_MESSAGE_HANDLER(PluginMsg_DestroyCommandBuffer,
150 OnDestroyCommandBuffer)
136 #if defined(OS_MACOSX) 151 #if defined(OS_MACOSX)
137 IPC_MESSAGE_HANDLER(PluginMsg_SetFakeAcceleratedSurfaceWindowHandle, 152 IPC_MESSAGE_HANDLER(PluginMsg_SetFakeAcceleratedSurfaceWindowHandle,
138 OnSetFakeAcceleratedSurfaceWindowHandle) 153 OnSetFakeAcceleratedSurfaceWindowHandle)
139 #endif 154 #endif
140 IPC_MESSAGE_UNHANDLED(handled = false) 155 IPC_MESSAGE_UNHANDLED(handled = false)
141 IPC_END_MESSAGE_MAP() 156 IPC_END_MESSAGE_MAP()
142 157
143 if (!in_destructor_) 158 if (!in_destructor_)
144 Release(); 159 Release();
145 160
(...skipping 248 matching lines...) Expand 10 before | Expand all | Expand 10 after
394 } 409 }
395 410
396 void WebPluginDelegateStub::OnDidManualLoadFail() { 411 void WebPluginDelegateStub::OnDidManualLoadFail() {
397 delegate_->DidManualLoadFail(); 412 delegate_->DidManualLoadFail();
398 } 413 }
399 414
400 void WebPluginDelegateStub::OnInstallMissingPlugin() { 415 void WebPluginDelegateStub::OnInstallMissingPlugin() {
401 delegate_->InstallMissingPlugin(); 416 delegate_->InstallMissingPlugin();
402 } 417 }
403 418
419 void WebPluginDelegateStub::OnCreateCommandBuffer(int* route_id) {
420 *route_id = 0;
421 #if defined(ENABLE_GPU)
422 // Fail to create the command buffer if some GL implementation cannot be
423 // initialized.
424 if (!gfx::GLContext::InitializeOneOff())
425 return;
426
427 command_buffer_stub_.reset(new CommandBufferStub(
428 channel_,
429 instance_id_,
430 delegate_->windowed_handle()));
431
432 *route_id = command_buffer_stub_->route_id();
433 #endif // ENABLE_GPU
434 }
435
436 void WebPluginDelegateStub::OnDestroyCommandBuffer() {
437 #if defined(ENABLE_GPU)
438 command_buffer_stub_.reset();
439 #endif
440 }
441
404 void WebPluginDelegateStub::CreateSharedBuffer( 442 void WebPluginDelegateStub::CreateSharedBuffer(
405 uint32 size, 443 uint32 size,
406 base::SharedMemory* shared_buf, 444 base::SharedMemory* shared_buf,
407 base::SharedMemoryHandle* remote_handle) { 445 base::SharedMemoryHandle* remote_handle) {
408 if (!shared_buf->CreateAndMapAnonymous(size)) { 446 if (!shared_buf->CreateAndMapAnonymous(size)) {
409 NOTREACHED(); 447 NOTREACHED();
410 shared_buf->Close(); 448 shared_buf->Close();
411 return; 449 return;
412 } 450 }
413 451
(...skipping 28 matching lines...) Expand all
442 webplugin_->OnResourceCreated(resource_id, resource_client); 480 webplugin_->OnResourceCreated(resource_id, resource_client);
443 } 481 }
444 482
445 #if defined(OS_MACOSX) 483 #if defined(OS_MACOSX)
446 void WebPluginDelegateStub::OnSetFakeAcceleratedSurfaceWindowHandle( 484 void WebPluginDelegateStub::OnSetFakeAcceleratedSurfaceWindowHandle(
447 gfx::PluginWindowHandle window) { 485 gfx::PluginWindowHandle window) {
448 delegate_->set_windowed_handle(window); 486 delegate_->set_windowed_handle(window);
449 } 487 }
450 #endif 488 #endif
451 489
OLDNEW
« no previous file with comments | « chrome/plugin/webplugin_delegate_stub.h ('k') | chrome/renderer/webplugin_delegate_pepper.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698