Commit 8d49dd6e authored by Kevin McNee's avatar Kevin McNee Committed by Commit Bot

Use static_cast instead of reinterpret_cast for downcasting

static_cast is better suited for downcasting since it can check that the
types are related.

/components/data_reduction_proxy
This CL was uploaded by git cl split.

R=tbansal@chromium.org

Change-Id: Idf2ab419bf07cd41493076a887390d93c1f8266a
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2435582
Auto-Submit: Kevin McNee <mcnee@chromium.org>
Reviewed-by: default avatarTarun Bansal <tbansal@chromium.org>
Commit-Queue: Tarun Bansal <tbansal@chromium.org>
Cr-Commit-Position: refs/heads/master@{#813426}
parent 8812a97a
...@@ -560,7 +560,7 @@ DataReductionProxyTestContext::data_reduction_proxy_service() const { ...@@ -560,7 +560,7 @@ DataReductionProxyTestContext::data_reduction_proxy_service() const {
TestDataReductionProxyService* TestDataReductionProxyService*
DataReductionProxyTestContext::test_data_reduction_proxy_service() const { DataReductionProxyTestContext::test_data_reduction_proxy_service() const {
DCHECK(!(test_context_flags_ & USE_MOCK_SERVICE)); DCHECK(!(test_context_flags_ & USE_MOCK_SERVICE));
return reinterpret_cast<TestDataReductionProxyService*>( return static_cast<TestDataReductionProxyService*>(
data_reduction_proxy_service()); data_reduction_proxy_service());
} }
...@@ -568,21 +568,21 @@ MockDataReductionProxyService* ...@@ -568,21 +568,21 @@ MockDataReductionProxyService*
DataReductionProxyTestContext::mock_data_reduction_proxy_service() const { DataReductionProxyTestContext::mock_data_reduction_proxy_service() const {
DCHECK(!(test_context_flags_ & SKIP_SETTINGS_INITIALIZATION)); DCHECK(!(test_context_flags_ & SKIP_SETTINGS_INITIALIZATION));
DCHECK(test_context_flags_ & USE_MOCK_SERVICE); DCHECK(test_context_flags_ & USE_MOCK_SERVICE);
return reinterpret_cast<MockDataReductionProxyService*>( return static_cast<MockDataReductionProxyService*>(
data_reduction_proxy_service()); data_reduction_proxy_service());
} }
MockDataReductionProxyRequestOptions* MockDataReductionProxyRequestOptions*
DataReductionProxyTestContext::mock_request_options() const { DataReductionProxyTestContext::mock_request_options() const {
DCHECK(test_context_flags_ & USE_MOCK_REQUEST_OPTIONS); DCHECK(test_context_flags_ & USE_MOCK_REQUEST_OPTIONS);
return reinterpret_cast<MockDataReductionProxyRequestOptions*>( return static_cast<MockDataReductionProxyRequestOptions*>(
data_reduction_proxy_service()->request_options()); data_reduction_proxy_service()->request_options());
} }
TestDataReductionProxyConfigServiceClient* TestDataReductionProxyConfigServiceClient*
DataReductionProxyTestContext::test_config_client() { DataReductionProxyTestContext::test_config_client() {
DCHECK(test_context_flags_ & USE_TEST_CONFIG_CLIENT); DCHECK(test_context_flags_ & USE_TEST_CONFIG_CLIENT);
return reinterpret_cast<TestDataReductionProxyConfigServiceClient*>( return static_cast<TestDataReductionProxyConfigServiceClient*>(
data_reduction_proxy_service()->config_client()); data_reduction_proxy_service()->config_client());
} }
......
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