| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2011 Google Inc. All rights reserved. | 2 * Copyright (C) 2011 Google Inc. All rights reserved. |
| 3 * | 3 * |
| 4 * Redistribution and use in source and binary forms, with or without | 4 * Redistribution and use in source and binary forms, with or without |
| 5 * modification, are permitted provided that the following conditions are | 5 * modification, are permitted provided that the following conditions are |
| 6 * met: | 6 * met: |
| 7 * | 7 * |
| 8 * * Redistributions of source code must retain the above copyright | 8 * * Redistributions of source code must retain the above copyright |
| 9 * notice, this list of conditions and the following disclaimer. | 9 * notice, this list of conditions and the following disclaimer. |
| 10 * * Redistributions in binary form must reproduce the above | 10 * * Redistributions in binary form must reproduce the above |
| (...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 64 | 64 |
| 65 String DataTransferItem::type() const { | 65 String DataTransferItem::type() const { |
| 66 if (!m_dataTransfer->canReadTypes()) | 66 if (!m_dataTransfer->canReadTypes()) |
| 67 return String(); | 67 return String(); |
| 68 return m_item->type(); | 68 return m_item->type(); |
| 69 } | 69 } |
| 70 | 70 |
| 71 static void runGetAsStringTask(ExecutionContext* context, | 71 static void runGetAsStringTask(ExecutionContext* context, |
| 72 StringCallback* callback, | 72 StringCallback* callback, |
| 73 const String& data) { | 73 const String& data) { |
| 74 InspectorInstrumentation::AsyncTask asyncTask(context, callback); | 74 probe::AsyncTask asyncTask(context, callback); |
| 75 if (context) | 75 if (context) |
| 76 callback->handleEvent(data); | 76 callback->handleEvent(data); |
| 77 } | 77 } |
| 78 | 78 |
| 79 void DataTransferItem::getAsString(ScriptState* scriptState, | 79 void DataTransferItem::getAsString(ScriptState* scriptState, |
| 80 StringCallback* callback) const { | 80 StringCallback* callback) const { |
| 81 if (!m_dataTransfer->canReadData()) | 81 if (!m_dataTransfer->canReadData()) |
| 82 return; | 82 return; |
| 83 if (!callback || m_item->kind() != DataObjectItem::StringKind) | 83 if (!callback || m_item->kind() != DataObjectItem::StringKind) |
| 84 return; | 84 return; |
| 85 | 85 |
| 86 ExecutionContext* context = scriptState->getExecutionContext(); | 86 ExecutionContext* context = scriptState->getExecutionContext(); |
| 87 InspectorInstrumentation::asyncTaskScheduled( | 87 probe::asyncTaskScheduled(context, "DataTransferItem.getAsString", callback); |
| 88 context, "DataTransferItem.getAsString", callback); | |
| 89 TaskRunnerHelper::get(TaskType::UserInteraction, scriptState) | 88 TaskRunnerHelper::get(TaskType::UserInteraction, scriptState) |
| 90 ->postTask(BLINK_FROM_HERE, | 89 ->postTask(BLINK_FROM_HERE, |
| 91 WTF::bind(&runGetAsStringTask, wrapWeakPersistent(context), | 90 WTF::bind(&runGetAsStringTask, wrapWeakPersistent(context), |
| 92 wrapPersistent(callback), m_item->getAsString())); | 91 wrapPersistent(callback), m_item->getAsString())); |
| 93 } | 92 } |
| 94 | 93 |
| 95 File* DataTransferItem::getAsFile() const { | 94 File* DataTransferItem::getAsFile() const { |
| 96 if (!m_dataTransfer->canReadData()) | 95 if (!m_dataTransfer->canReadData()) |
| 97 return nullptr; | 96 return nullptr; |
| 98 | 97 |
| 99 return m_item->getAsFile(); | 98 return m_item->getAsFile(); |
| 100 } | 99 } |
| 101 | 100 |
| 102 DataTransferItem::DataTransferItem(DataTransfer* dataTransfer, | 101 DataTransferItem::DataTransferItem(DataTransfer* dataTransfer, |
| 103 DataObjectItem* item) | 102 DataObjectItem* item) |
| 104 : m_dataTransfer(dataTransfer), m_item(item) {} | 103 : m_dataTransfer(dataTransfer), m_item(item) {} |
| 105 | 104 |
| 106 DEFINE_TRACE(DataTransferItem) { | 105 DEFINE_TRACE(DataTransferItem) { |
| 107 visitor->trace(m_dataTransfer); | 106 visitor->trace(m_dataTransfer); |
| 108 visitor->trace(m_item); | 107 visitor->trace(m_item); |
| 109 } | 108 } |
| 110 | 109 |
| 111 } // namespace blink | 110 } // namespace blink |
| OLD | NEW |