Commit daef62d8 authored by Julie Jeongeun Kim's avatar Julie Jeongeun Kim Committed by Commit Bot

Clean up old Mojo types for mojom::MhtmlFileWriter

This CL cleans up old Mojo types for mojom::MhtmlFileWriter with
replacing AssociatedBinding and MhtmlFileWriterAssociatedRequest
with AssociatedReceiver and PendingAssociatedReceiver.

Bug: 955171
Change-Id: I55f3209dcddbaa734e029ec34b881015bd5a2d84
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1880207
Commit-Queue: Min Qin <qinmin@chromium.org>
Reviewed-by: default avatarMin Qin <qinmin@chromium.org>
Reviewed-by: default avatarOksana Zhuravlova <oksamyt@chromium.org>
Cr-Commit-Position: refs/heads/master@{#709969}
parent 96ca0abb
...@@ -38,6 +38,8 @@ ...@@ -38,6 +38,8 @@
#include "content/shell/browser/shell.h" #include "content/shell/browser/shell.h"
#include "crypto/secure_hash.h" #include "crypto/secure_hash.h"
#include "crypto/sha2.h" #include "crypto/sha2.h"
#include "mojo/public/cpp/bindings/associated_receiver.h"
#include "mojo/public/cpp/bindings/pending_associated_receiver.h"
#include "net/base/filename_util.h" #include "net/base/filename_util.h"
#include "net/dns/mock_host_resolver.h" #include "net/dns/mock_host_resolver.h"
#include "net/test/embedded_test_server/embedded_test_server.h" #include "net/test/embedded_test_server/embedded_test_server.h"
...@@ -110,11 +112,12 @@ const char kTestData[] = ...@@ -110,11 +112,12 @@ const char kTestData[] =
class MockWriterBase : public mojom::MhtmlFileWriter { class MockWriterBase : public mojom::MhtmlFileWriter {
public: public:
MockWriterBase() : binding_(this) {} MockWriterBase() = default;
~MockWriterBase() override {} ~MockWriterBase() override = default;
void BindRequest(mojo::ScopedInterfaceEndpointHandle handle) { void BindReceiver(mojo::ScopedInterfaceEndpointHandle handle) {
binding_.Bind(mojom::MhtmlFileWriterAssociatedRequest(std::move(handle))); receiver_.Bind(mojo::PendingAssociatedReceiver<mojom::MhtmlFileWriter>(
std::move(handle)));
} }
protected: protected:
...@@ -139,7 +142,7 @@ class MockWriterBase : public mojom::MhtmlFileWriter { ...@@ -139,7 +142,7 @@ class MockWriterBase : public mojom::MhtmlFileWriter {
producer_pipe.reset(); producer_pipe.reset();
} }
mojo::AssociatedBinding<mojom::MhtmlFileWriter> binding_; mojo::AssociatedReceiver<mojom::MhtmlFileWriter> receiver_{this};
private: private:
DISALLOW_COPY_AND_ASSIGN(MockWriterBase); DISALLOW_COPY_AND_ASSIGN(MockWriterBase);
...@@ -221,13 +224,13 @@ class RespondAndDisconnectMockWriter ...@@ -221,13 +224,13 @@ class RespondAndDisconnectMockWriter
SendResponse(std::move(callback)); SendResponse(std::move(callback));
// Close the message pipe connection to invoke the connection error // Reset the message pipe connection to invoke the disconnect callback. The
// callback. The connection error handler from here will finalize // disconnect handler from here will finalize the Job and attempt to call
// the Job and attempt to call MHTMLGenerationManager::Job::CloseFile // MHTMLGenerationManager::Job::CloseFile a second time. If this situation
// a second time. If this situation is handled correctly, the // is handled correctly, the browser file should be invalidated and
// browser file should be invalidated and idempotent. // idempotent.
if (!compute_contents_hash) { if (!compute_contents_hash) {
binding_.Unbind(); receiver_.reset();
return; return;
} }
...@@ -259,7 +262,7 @@ class RespondAndDisconnectMockWriter ...@@ -259,7 +262,7 @@ class RespondAndDisconnectMockWriter
scoped_refptr<RespondAndDisconnectMockWriter>(this))); scoped_refptr<RespondAndDisconnectMockWriter>(this)));
} }
void TaskZ() { binding_.Unbind(); } void TaskZ() { receiver_.reset(); }
private: private:
friend base::RefCountedThreadSafe<RespondAndDisconnectMockWriter>; friend base::RefCountedThreadSafe<RespondAndDisconnectMockWriter>;
...@@ -298,7 +301,7 @@ class MHTMLGenerationTest ...@@ -298,7 +301,7 @@ class MHTMLGenerationTest
->GetRemoteAssociatedInterfaces(); ->GetRemoteAssociatedInterfaces();
remote_interfaces->OverrideBinderForTesting( remote_interfaces->OverrideBinderForTesting(
mojom::MhtmlFileWriter::Name_, mojom::MhtmlFileWriter::Name_,
base::BindRepeating(&MockWriterBase::BindRequest, base::BindRepeating(&MockWriterBase::BindReceiver,
base::Unretained(mock_writer))); base::Unretained(mock_writer)));
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment