OLD | NEW |
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 "chrome/browser/renderer_host/resource_message_filter.h" | 5 #include "chrome/browser/renderer_host/resource_message_filter.h" |
6 | 6 |
7 #include "app/clipboard/clipboard.h" | 7 #include "app/clipboard/clipboard.h" |
8 #include "base/callback.h" | 8 #include "base/callback.h" |
9 #include "base/command_line.h" | 9 #include "base/command_line.h" |
10 #include "base/file_util.h" | 10 #include "base/file_util.h" |
(...skipping 852 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
863 new WriteClipboardTask(long_living_objects)); | 863 new WriteClipboardTask(long_living_objects)); |
864 } | 864 } |
865 | 865 |
866 void ResourceMessageFilter::OnClipboardWriteObjectsAsync( | 866 void ResourceMessageFilter::OnClipboardWriteObjectsAsync( |
867 const Clipboard::ObjectMap& objects) { | 867 const Clipboard::ObjectMap& objects) { |
868 // We cannot write directly from the IO thread, and cannot service the IPC | 868 // We cannot write directly from the IO thread, and cannot service the IPC |
869 // on the UI thread. We'll copy the relevant data and post a task to preform | 869 // on the UI thread. We'll copy the relevant data and post a task to preform |
870 // the write on the UI thread. | 870 // the write on the UI thread. |
871 Clipboard::ObjectMap* long_living_objects = new Clipboard::ObjectMap(objects); | 871 Clipboard::ObjectMap* long_living_objects = new Clipboard::ObjectMap(objects); |
872 | 872 |
| 873 // This async message doesn't support shared-memory based bitmaps; they must |
| 874 // be removed otherwise we might dereference a rubbish pointer. |
| 875 long_living_objects->erase(Clipboard::CBF_SMBITMAP); |
| 876 |
873 ChromeThread::PostTask( | 877 ChromeThread::PostTask( |
874 ChromeThread::UI, | 878 ChromeThread::UI, |
875 FROM_HERE, | 879 FROM_HERE, |
876 new WriteClipboardTask(long_living_objects)); | 880 new WriteClipboardTask(long_living_objects)); |
877 } | 881 } |
878 | 882 |
879 #if !defined(USE_X11) | 883 #if !defined(USE_X11) |
880 // On non-X11 platforms, clipboard actions can be performed on the IO thread. | 884 // On non-X11 platforms, clipboard actions can be performed on the IO thread. |
881 // On X11, since the clipboard is linked with GTK, we either have to do this | 885 // On X11, since the clipboard is linked with GTK, we either have to do this |
882 // with GTK on the UI thread, or with Xlib on the BACKGROUND_X11 thread. In an | 886 // with GTK on the UI thread, or with Xlib on the BACKGROUND_X11 thread. In an |
(...skipping 586 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1469 dictionary_map.insert( | 1473 dictionary_map.insert( |
1470 std::make_pair(ExtensionMessageBundle::kExtensionIdKey, extension_id)); | 1474 std::make_pair(ExtensionMessageBundle::kExtensionIdKey, extension_id)); |
1471 | 1475 |
1472 ViewHostMsg_GetExtensionMessageBundle::WriteReplyParams( | 1476 ViewHostMsg_GetExtensionMessageBundle::WriteReplyParams( |
1473 reply_msg, dictionary_map); | 1477 reply_msg, dictionary_map); |
1474 | 1478 |
1475 ChromeThread::PostTask( | 1479 ChromeThread::PostTask( |
1476 ChromeThread::IO, FROM_HERE, | 1480 ChromeThread::IO, FROM_HERE, |
1477 NewRunnableMethod(this, &ResourceMessageFilter::Send, reply_msg)); | 1481 NewRunnableMethod(this, &ResourceMessageFilter::Send, reply_msg)); |
1478 } | 1482 } |
OLD | NEW |