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