Yes, trying to do this in renderer process. Would it work if I run Chromium
with --nosandbox flag.

On Tue, Apr 30, 2024, 21:58 Ken Russell <[email protected]> wrote:

> Are you trying to do this within Chrome's renderer or GPU processes? If
> so, the sandbox will prevent you from touching the local disk. You would
> need to extend the sandbox policies to allow writing to a directory on disk
> - some place that will not collide with other programs, so that if a bad
> actor causes data to be written to that directory, no harm will be caused.
> See
> https://source.chromium.org/chromium/chromium/src/+/main:sandbox/policy/mac/
> for the macOS sandbox policies.
>
> -Ken
>
>
>
> On Tue, Apr 30, 2024 at 8:59 AM Steven Whelan <[email protected]>
> wrote:
>
>> Hi
>> I have modified the Serialize
>> <https://source.chromium.org/chromium/chromium/src/+/main:cc/paint/paint_op_buffer_serializer.cc;l=5;bpv=1;bpt=1?q=paint_op_buffer_ser&ss=chromium%2Fchromium%2Fsrc>
>>  method
>> to Record all PaintOp as SKPicture.
>> I want to replay this SKPicture on a remote browser. So, I am trying to
>> save this SKPicture to a file, but I am not able to do so, since
>> file.isOpen gives false.
>> Please help here
>>
>> void PaintOpBufferSerializer::Serialize(const PaintOpBuffer& buffer,
>>                                         const std::vector<size_t>*
>> offsets,
>>                                         const Preamble& preamble) {
>>   DCHECK_EQ(serialized_op_count_, 0u);
>>
>>   std::unique_ptr<SkCanvas> canvas = MakeAnalysisCanvas(options_);
>>   // These PlaybackParams use the initial (identity) canvas matrix, as
>> they are
>>   // only used for serializing the preamble and the initial save / final
>> restore
>>   // SerializeBuffer will create its own PlaybackParams based on the
>>
>>  * SkPictureRecorder recorder;*
>>  * SkCanvas* recordingCanvas =
>> recorder.beginRecording(canvas->getLocalClipBounds());         *
>>   // post-preamble canvas.
>>   PlaybackParams params = MakeParams(canvas.get());
>>   int save_count = canvas->getSaveCount();
>>   Save(canvas.get(), params);
>>   SerializePreamble(canvas.get(), preamble, params);
>>   SerializeBuffer(canvas.get(), buffer, offsets);
>>   *SerializeBuffer(recordingCanvas, buffer, offsets);*
>>
>>
>> *sk_sp<SkPicture> picture = recorder.finishRecordingAsPicture();
>> SkSerialProcs sProcs;  sk_sp<SkData> readableData =
>> picture->serialize(&sProcs);*
>>   // Assuming the byte array is stored in the 'data' field of the SkData
>> object
>>   const void* data = readableData->data();
>>   size_t size = readableData->size();
>>
>> * <HOW TO SAVE READABLE DATA TO A FILE>*
>>   /*sk_sp<SkData> receievedData = SkData::MakeWithoutCopy(data, size);
>>   sk_sp<SkPicture> copy =
>>       SkPicture::MakeFromData(receievedData->data(),
>> receievedData->size());
>>   copy->playback(recordingCanvas);*/
>>   RestoreToCount(canvas.get(), save_count, params);
>> }
>>
>> --
>> You received this message because you are subscribed to the Google Groups
>> "blink-dev" group.
>> To unsubscribe from this group and stop receiving emails from it, send an
>> email to [email protected].
>> To view this discussion on the web visit
>> https://groups.google.com/a/chromium.org/d/msgid/blink-dev/97946d8b-27dc-43c4-a262-e4f6288be9d6n%40chromium.org
>> <https://groups.google.com/a/chromium.org/d/msgid/blink-dev/97946d8b-27dc-43c4-a262-e4f6288be9d6n%40chromium.org?utm_medium=email&utm_source=footer>
>> .
>>
>

-- 
You received this message because you are subscribed to the Google Groups 
"blink-dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/a/chromium.org/d/msgid/blink-dev/CAO%2BCLgCWVV5q%2BnPcTXW7v_x9_zperfwifFThPfLpUba98mRjpQ%40mail.gmail.com.

Reply via email to