Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(27)

Side by Side Diff: third_party/WebKit/Source/platform/exported/WrappedResourceResponse.h

Issue 2120233003: [OBSOLETE] Remove WebURLResponse::initialize() (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Remove non-const WrappedResourceResponse::bind() Created 4 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2009 Google Inc. All rights reserved. 2 * Copyright (C) 2009 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 19 matching lines...) Expand all
30 30
31 #ifndef WrappedResourceResponse_h 31 #ifndef WrappedResourceResponse_h
32 #define WrappedResourceResponse_h 32 #define WrappedResourceResponse_h
33 33
34 #include "platform/exported/WebURLResponsePrivate.h" 34 #include "platform/exported/WebURLResponsePrivate.h"
35 #include "public/platform/WebURLResponse.h" 35 #include "public/platform/WebURLResponse.h"
36 #include "wtf/Allocator.h" 36 #include "wtf/Allocator.h"
37 37
38 namespace blink { 38 namespace blink {
39 39
40 class WrappedResourceResponse : public WebURLResponse { 40 class WrappedResourceResponse : public WebURLResponse {
kinuko 2016/07/05 14:59:44 Hmm ok, WebURLResponsePrivate is non-copyable so t
kinuko 2016/07/05 14:59:44 How this one's copy assignment works?
41 public: 41 public:
42 ~WrappedResourceResponse() 42 ~WrappedResourceResponse() {}
43 {
44 reset(); // Need to drop reference to m_handle
45 }
46 43
47 WrappedResourceResponse() { } 44 WrappedResourceResponse() { }
kinuko 2016/07/05 14:59:44 Doesn't it cost us creating a WebURLRespnsePrivate
Adam Rice 2016/07/06 01:50:50 I don't think it makes sense to have a default con
48 45
49 WrappedResourceResponse(ResourceResponse& resourceResponse) 46 explicit WrappedResourceResponse(ResourceResponse& resourceResponse)
47 : WebURLResponse(&m_handle)
48 , m_handle(&resourceResponse)
50 { 49 {
51 bind(resourceResponse);
52 } 50 }
53 51
54 WrappedResourceResponse(const ResourceResponse& resourceResponse) 52 explicit WrappedResourceResponse(const ResourceResponse& resourceResponse)
53 : WrappedResourceResponse(const_cast<ResourceResponse&>(resourceResponse ))
55 { 54 {
56 bind(resourceResponse);
57 }
58
59 void bind(ResourceResponse& resourceResponse)
60 {
61 m_handle.m_resourceResponse = &resourceResponse;
62 assign(&m_handle);
63 } 55 }
64 56
65 void bind(const ResourceResponse& resourceResponse) 57 void bind(const ResourceResponse& resourceResponse)
66 { 58 {
67 bind(*const_cast<ResourceResponse*>(&resourceResponse)); 59 m_handle.m_resourceResponse = const_cast<ResourceResponse*>(&resourceRes ponse);
60 assign(&m_handle);
68 } 61 }
69 62
70 private: 63 private:
71 class Handle : public WebURLResponsePrivate { 64 class Handle : public WebURLResponsePrivate {
72 DISALLOW_NEW(); 65 DISALLOW_NEW();
73 public: 66 public:
74 virtual void dispose() { m_resourceResponse = 0; } 67 Handle() {}
68 explicit Handle(ResourceResponse* resourceResponse)
69 {
70 m_resourceResponse = resourceResponse;
71 }
72 void dispose() override { m_resourceResponse = 0; }
kinuko 2016/07/05 15:42:11 I don't feel I like this trick in general... I pre
75 }; 73 };
76 74
77 Handle m_handle; 75 Handle m_handle;
78 }; 76 };
79 77
80 } // namespace blink 78 } // namespace blink
81 79
82 #endif 80 #endif
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698