Instead of ArrayBuffer, pass blob with printerProvider.onPrintRequested
This will allow us to pass larger amout of data to the extension. With
array buffer sending more than ~60MB documents would crash the renderer.
For data converted to PWG raster, the data is written to a temp file
during conversion. To avoid reading the data back into memory, use
file backed blob to represent this data.
The blob passed to the extension is created in the API custom bindings
using newly added chrome.printerProviderInternal.getPrintData function,
which creates the blob and returns data needed by the renderer to take
the ownership of the blob.
For creating file backed blob in printer_provider_internal_api.cc,
this add BrowserContext::CreateFileBackedBlob (analogous to existing
CreateMemoryBackedBlob) method, which can be used from extensions/
BUG=461115
TEST=Manually verified that a ~150MB PWG raster data can be passed to a
test preintrProvider extension.
extensions_browsertests --gtest_filter=PrinterProviderAPI*
unit_tests --gtest_filter=ExtensionPrinterHandler*
Review URL: https://codereview.chromium.org/973993003
Cr-Commit-Position: refs/heads/master@{#319416}
diff --git a/extensions/browser/extension_function_histogram_value.h b/extensions/browser/extension_function_histogram_value.h
index 319d2ac..11bc1cd 100644
--- a/extensions/browser/extension_function_histogram_value.h
+++ b/extensions/browser/extension_function_histogram_value.h
@@ -1032,6 +1032,7 @@
INPUTMETHODPRIVATE_FETCHALLDICTIONARYWORDS,
INPUTMETHODPRIVATE_ADDWORDTODICTIONARY,
WEBSTOREPRIVATE_SHOWPERMISSIONPROMPTFORDELEGATEDINSTALL,
+ PRINTERPROVIDERINTERNAL_GETPRINTDATA,
// Last entry: Add new entries above and ensure to update
// tools/metrics/histograms/histograms.xml.
ENUM_BOUNDARY